Posted 27 March 2019, 11:42 am EST
Hi,
We are having an issue with the FlexReport, looks like it is calling multiple times the Database, before and after OnPrint Property.
We have a report which has a couple of subreports and also some code on the OnPrint Property. The behavior from Old Report to the new FlexReport looks like changed:
- “[/ul]Legacy C1Report: Is calling the Database only after we made a change on the recordsource.
[ul]”
FlexReport: Is calling the Database before we made the change and after. This is causing a big issue because is retrieving all the data in the tables.
This is a little piece of code of the OnPrint property.
'************************Timecharges Subreport*********************
'Get subreport datasource
subR= TimeCharges.subreport.datasource.recordsource
'find if the subR has a where clause
pos2= instr(subR,"where")
if pos2=0 then
'No where clause, then add one using the current IDAsset
newField=subR & " where " & " vtblTimeCharges.IDWorkOrder = '" & IDWorkORder & "'"
else
'delete old where clause, add new one.
oldvalue=left(subR,pos2 -1)
newField=oldvalue & " where " & " vtblTimeCharges.IDWorkOrder = '" & IDWorkORder & "'"
end if
'update Subreport Datasource
TimeCharges.subreport.datasource.recordsource=newfield
Running the SQL Profiler we can see all the calls to the DB and noticed the different calls from the report.
We also put a msgbox at the beginning of the OnPrint property and the DB is being called with the subreport query before the message is being shown. This didn’t happen on the legacy C1Report.
We need to know what can we do to avoid the mulple calls to the Database.