LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: Proton Phoenix on May 25, 2022, 07:20:37 PM

Title: how to print each row number in limereport? using QTableWidget as datasource
Post by: Proton Phoenix on May 25, 2022, 07:20:37 PM
Hi this is the best reporting engine ever thank you really for your great work
, i have a question , so i have Qtablewidget which contain a 3 columns
i want to get each row number when reporting using limereport
is there any way to do that!
for example i want those numbers on limereport
when viewing data the numbers show up, the databind doesn't support more than one datasource
is there any solution !!
(https://i.imgur.com/uUJmXqE.jpg)
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Subst on May 25, 2022, 08:54:35 PM
the simplest way it's using the variable & script system
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Proton Phoenix on May 25, 2022, 10:23:37 PM
the simplest way it's using the variable & script system



i did that but the variable won't change because datasource is QTableWidget!
so i need to search for a script to solve that !
Thank you bro
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Subst on May 26, 2022, 07:33:45 AM
It's simple.

How you form the report?
by callback function?
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Proton Phoenix on May 26, 2022, 01:31:06 PM
It's simple.

How you form the report?
by callback function?

no i didn't use callback i am just a beginner in limereport

 
Code: [Select]
report->loadFromFile(QDir::currentPath()+"/release/report/test2.lrxml");
    report->dataManager()->addModel("tablewidget",ui->tableWidget->model(),false);
    QStringList stringlist;
    stringlist.clear();
    for(int i=1;i<ui->tableWidget->rowCount();i++){
      stringlist<<QString::number(i);
    }
    qDebug()<<"stringlist="<<stringlist;
    QStringListModel* stringListModel = new QStringListModel();
    stringListModel->setStringList(stringlist);

     report->dataManager()->addModel("strlist",stringListModel,true);


     report->designReport();

in DataBand1 i am using QTableWidget as datasource
i got the strlist data successfully which it's value from 1 to 511
but when i use it it stays only 1 on every row
if i change databand1 datasource to strlist it became 1 ..... to 511
but QTableWidget became unchangable !!


Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Subst on May 26, 2022, 07:14:45 PM
The real data changed in first variant?
But you can't got the string number?
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Proton Phoenix on May 26, 2022, 09:11:51 PM
The real data changed in first variant?
But you can't got the string number?

Yep the first variant changed every row to 511 of items .. because datasource is QTableWidget
but the second one didn't it only get the first index which is 1 and it keep repeating it ,because it's not the datasource of DataBand1
if i change the DataBind1 datasource to strlist it will get the second changed but the first one keep showing just the first index (product item) and keep repeating it
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Subst on May 27, 2022, 05:54:34 AM
can u send me your .lrxml file?
Title: Re: how to print each row number in limereport? using QTableWidget as datasource
Post by: Proton Phoenix on May 27, 2022, 02:39:41 PM
Thank you bro i did fix the problem by adding a column which contain the numbers then hiding it from the user in QTableWidget.