2 DataBands referencing one TableDataSource (results in 2 database queries)
I have 2 DataBands that reference the same TableDataSource. When generating the report, the table initialization happens twice (meaning the PostgreSQL database query is executed twice). Is there a way to avoid the second initialization of the TableDataSource?
I am using FastReport Designer version 2024.1.10 (and also have the option to edit the report in FastReport Online Designer version 2025.2.3).
This discussion has been closed.
Comments
Hello!
Each band initialises its own source, and the data is reloaded if ForceLoadData is enabled for the source, or if the band passes its own Filter/Sort parameters; in this case, Init(filter, sort) is called and the source is reinitialised with the new parameters.
In the .frx file, remove ForceLoadData (set to false by default).
Do not set Sort/Filter on the second band; set them on the source itself (AdditionalFilter) or once in the code.
It is also possible to use a single query in C# and `report.RegisterData(dataTable, ‘Orders’)` — both bands read the same table in memory.