Recent

Author Topic: LazReport [ CLOSED ]  (Read 1337 times)

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
LazReport [ CLOSED ]
« on: November 17, 2018, 05:28:16 am »
How to create LazReport programatically. My project takes different database as per user choice. If somebody can provide sample code or demo project than it will be very usefull.
« Last Edit: December 04, 2018, 04:41:11 pm by Deepaak »
Holiday season is online now. :-)

balazsszekely

  • Guest
Re: LazReport
« Reply #1 on: November 17, 2018, 09:56:32 am »
@Deepaak
Quote
How to create LazReport programatically. My project takes different database as per user choice. If somebody can provide sample code or demo project than it will be very usefull.
I'm not sure what you mean. Each LazReport has a DataSet property, which can be assigned just before the report starts like this:
Code: Pascal  [Select][+][-]
  1. frReport1.Dataset := frDBDataSet1;

frDBDataSet1 has a DataSet/DataSource property, you can also change that according to your needs:
Code: Pascal  [Select][+][-]
  1. frDBDataSet1.DataSet := SQLQuery1;
The query can be linked to whatever database you like.

On the other hand it's also possible to create a report dynamically from scratch, you can find an example for FortesReport here: http://forum.lazarus.freepascal.org/index.php/topic,43151.msg301584.html#msg301584. You can do the same thing for LazReport, but building a complex report dynamically though it's not particularly hard, it's a time consuming task.



 

TinyPortal © 2005-2018