LimeReport Forum

General Category | Основное => Discussion | Обсуждение => Topic started by: newzen on February 22, 2017, 05:25:21 AM

Title: bug into demo_r1 test_customers.lrxml
Post by: newzen on February 22, 2017, 05:25:21 AM
hi,

As is the example (demo_r1 test_customers.lrxml ) not work the error is

Field customers.CompanyName not found in TextItem1 !!!

if i change

report->dataManager()->addModel("external_customers_data",customersModel,true);

to

report->dataManager()->addModel("customers",customersModel,true);

error is

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'LimeReport::ReportError'
  what():  datasource with name "customers" already exists !

so, my solution is change into test_customers.lrxml the data source to
external_customers_data and field to $D(external_customers_data.CompanyName)

so I think  the problem is I can't design the report with a data source and then replace with custom model with he same name.

I don't now if there is the right place for bug. If not next time will place on right place

Thanks

Title: Re: bug into demo_r1 test_customers.lrxml
Post by: Arin Alex on February 22, 2017, 11:10:14 AM
Hi ! Thanks for your message.
The test_customers.lrxml file got there by an accident :)
The problem with this is that the file path to the database hardcoded to /home/alex/Work/C++Projects/LimeReport/demo_r1/demo_reports/northwind.db instead ./demo_reports/northwind.db
You can check it if press on (http://limereport.ru/images/error_message_2.png) button in the preview window
Title: Re: bug into demo_r1 test_customers.lrxml
Post by: newzen on February 22, 2017, 12:35:59 PM
northwind.db path have no effect on reported bug.

I make my own report and have the same problem.
Title: Re: bug into demo_r1 test_customers.lrxml
Post by: Arin Alex on February 22, 2017, 12:51:31 PM
If we speak about this
Quote
so I think  the problem is I can't design the report with a data source and then replace with custom model with he same name.
Yes it is not implemented yet. I will think about it
Title: Re: bug into demo_r1 test_customers.lrxml
Post by: newzen on February 22, 2017, 01:04:14 PM
a possible solution could be

dynamically replace the data source used by designer with the provided
by report->dataManager()->addModel("ds1", Model , true);

I mean get report.lrxml and replace $D{customers.CompanyName} with $D{ds1.CompanyName} on all fields and definitions with referenced to data source name

just my opinion
Title: Re: bug into demo_r1 test_customers.lrxml
Post by: Arin Alex on March 01, 2017, 11:20:16 AM
In the version 1.4.1 method "addModel" replace a model witout an exeption!