Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: bug into demo_r1 test_customers.lrxml  (Read 4465 times)

newzen

  • Newbie
  • *
  • Posts: 7
    • View Profile
bug into demo_r1 test_customers.lrxml
« 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


Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: bug into demo_r1 test_customers.lrxml
« Reply #1 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 button in the preview window
« Last Edit: February 22, 2017, 11:36:56 am by Arin Alex »

newzen

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: bug into demo_r1 test_customers.lrxml
« Reply #2 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.

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: bug into demo_r1 test_customers.lrxml
« Reply #3 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

newzen

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: bug into demo_r1 test_customers.lrxml
« Reply #4 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

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1005
    • View Profile
Re: bug into demo_r1 test_customers.lrxml
« Reply #5 on: March 01, 2017, 11:20:16 am »
In the version 1.4.1 method "addModel" replace a model witout an exeption!