LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: Mucip on March 03, 2020, 10:24:03 AM

Title: Dialog and Function browser?
Post by: Mucip on March 03, 2020, 10:24:03 AM
Hi,
There is Script Browser pane on the left side. But nothing happens when I press the buttons.
Is there any tutorial about how to add/edit/delete Functions and Dialogs?

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: Arin Alex on March 04, 2020, 09:59:29 AM
Hi!
Honestly, add/edit/delete Functions has no functionality :)
I had some ideas on how this might work, but I realized that these are not really needed functions.
What about dialogs there are two ways how you can add it to the report:
First, you can create a dialog using the embedded dialog designer.
Second, you can create it using qtcreator or qt dialog designer
and add it using button add at the dialog's tab.

What about how to create custom functions. 
You can create it using JavaScript in the init script or
create some object inherited from QObject with Q_INVOKABE methods
and register it in the script engine. 
Title: Re: Dialog and Function browser?
Post by: Mucip on March 04, 2020, 11:15:08 AM
Hi,
Wouv... Very deep and difficult situation for me... :)

OK. Let me forget about dialogs.

By the way where is the embedded dialog designer?

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: Arin Alex on March 17, 2020, 11:36:51 PM
Quote
By the way where is the embedded dialog designer?
(http://limereport.ru/images/run_designer.png)
Title: Re: Dialog and Function browser?
Post by: Mucip on March 22, 2020, 09:02:25 AM
Hi,
It looks well. Thanks. ;)

So how can we connect dialogs window to report functionality? Any document or demo?

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: Arin Alex on March 25, 2020, 01:46:33 AM
Hi Mucip!
I have created a small video about dialogs.
https://www.youtube.com/watch?v=ZG5j9R3RR34
Title: Re: Dialog and Function browser?
Post by: Mucip on March 26, 2020, 04:30:25 PM
Hi,
You're great Arin. Thanks.  ;)

This is very usefull. Sometims it's needed to hide something on the report depends on user demand. This dialog is good for this. Dialog confirms "Do you want to see prices?".

If user choose OK then we can see the prices on the report. Otherwise we hide the prices on the report.

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: solomon78 on March 26, 2020, 05:03:04 PM
Arin Alex, Thank you for uploading video about dialogs, please can you do video on how to add Limereport on Qt and query sqlite database? I will appreciate your effort
Title: Re: Dialog and Function browser?
Post by: Arin Alex on March 27, 2020, 10:43:51 AM
solomon78, Hi!
Quote
please can you do video on how to add Limereport on Qt
Sorry, I didn't clearly understand what do you mean.
If you ask how to add limereport to your project you can watch this video https://www.youtube.com/watch?v=Z7JOOQ187XE
Title: Re: Dialog and Function browser?
Post by: solomon78 on March 29, 2020, 09:41:35 PM
I mean how to query database from Qt GUI for example(Select * from categories). Thank you
Title: Re: Dialog and Function browser?
Post by: Mucip on March 30, 2020, 12:15:39 AM
Hi,
Let me explain mey way:
I will add these lines to header file

//For Lime Report
QSqlQueryModel *raporModel;
LimeReport::ReportEngine *mRapor;
//

And in the source code:

// to use LimeReport and fill the data into Model.
mRapor = new LimeReport::ReportEngine(this);
raporModel = new QSqlQueryModel(this);

raporModel->setQuery("SELECT * FROM tartim WHERE belge_no = '" + belge_no + "' ;");

//To load the LimeReport file.

if(!mRapor->loadFromFile(fileName))
    {
        QMessageBox::critical(this, "Hata!", fileName + " Dosyasına ulaşılamadı!");
        return;
    }

//And push the Model to Limereport. Because you fill the data to Model before.

mRapor->dataManager()->addModel("tartim", raporModel, false); //Use third parameter false if you don't want to delete Model after finishing job.:)

    mRapor->setResultEditable(false);

    mRapor->previewReport();

    //mRapor->designReport();

    //mRapor->printReport();



That's all. It's very easy. But the important thing create the LimeReport instance and the model just in time. Create them and use them. Otherwise the speed is going down.

Regards,
Mucip:)



Title: Re: Dialog and Function browser?
Post by: solomon78 on March 31, 2020, 10:42:22 AM
Mucip, Thank you, I will it a trial.
Title: Re: Dialog and Function browser?
Post by: solomon78 on April 22, 2020, 09:56:20 PM
Thank you Mucip for the help it work but I was having problem on how to query like "raporModel->setQuery("SELECT * FROM tartim WHERE belge_no = '" + belge_no + "' ;");" I want to select base on certain condition, it didn't work as I expected.
Title: Re: Dialog and Function browser?
Post by: Mucip on April 23, 2020, 09:43:44 PM
Hi,
Could you explain little bit more?
What is the problem? You can create SELECT statement and send it to LimeReport as I decribed.

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: solomon78 on April 24, 2020, 02:51:02 AM
Mucip, It didn't worked. It uploaded  entire information on the database without filtering or condition. please can you share me your details codes on where you made the selection? thanks
Title: Re: Dialog and Function browser?
Post by: Mucip on April 24, 2020, 11:15:37 AM
Hi,
SELECT * FROM tartim WHERE belge_no = '" + belge_no + "' ;"

This is the SELECT statement. You can apply like this filter to th DB and send it to LimeReport.

What is your SELECT statement?

Regards,
Mucip:)
Title: Re: Dialog and Function browser?
Post by: solomon78 on April 25, 2020, 12:58:18 PM
Thank you.