Page 1 of 1

:DelDataSet Question

Posted: Mon Dec 16, 2013 11:02 am
by mhsabado
Hi,
The :DelDataSet(oDS) deletes the oDS and the respective element value in :aDataSets is replace with NIL. This is causing problem in the displayed data of my report. I made a workaround (by copying to temporary array) to remove the element with NIL value from the :aDataSets and the report now displays the correct data.
Is it possible to automatically resize the :aDataSets when :DelDataSet is executed? Even using ADel() with lShrink set to true didn't help because a NIL value is still present.
Thanks,
Mario

:DelDataSet Question

Posted: Tue Dec 17, 2013 12:43 pm
by ignacio
mhsabado escribió el lun, 16 diciembre 2013 11:02
Hi,
The :DelDataSet(oDS) deletes the oDS and the respective element value in :aDataSets is replace with NIL. This is causing problem in the displayed data of my report. I made a workaround (by copying to temporary array) to remove the element with NIL value from the :aDataSets and the report now displays the correct data.
Is it possible to automatically resize the :aDataSets when :DelDataSet is executed? Even using ADel() with lShrink set to true didn't help because a NIL value is still present.
Thanks,
Mario

Hello,
Could you explain WHY you delete the dataset?
I can not understand why you have problems on the displayed data of your report. Are you using data fields from the deleted dataset? I guess not.
I have modified our console demo program with this code and is working nicely with absolutely no errors:
WITH OBJECT oReport := TFastReport():New()
oDs := :AddArray( "Dir1", Directory( "*.*" ), cStruct )
:AddArray( "Dir", Directory( "*.*" ), cStruct )
:DelDataset( oDs )
....

BTW, the element is replaced by NIL to avoid the use of ASCAN on the event subsystem, so to say, to gain speed.
Regards,

:DelDataSet Question

Posted: Wed Dec 18, 2013 5:47 am
by mhsabado
Hi Ignacio,
I have a function in my code that I just passed the dbf files and relations as parameters. Each dbf was added to report as DS. For dbf files that have relations, they were assigned to another DS (i.e., oDS:= :AddDbf(cAlias ,{"cAlias1->*","cAlias2->*"}). Since the related tables have been merge to a separate DS, I wanted to delete the other DS assigned to each individual dbf files to avoid redundancy. Although the MasterData in my report was assigned with DS that has relations, when a NIL exist in the :aDataSets, the report only displays up to 4 pages for the 70k records. If I try to issue ASize() to :aDataSets to eliminate the NIL element, the problem goes away and the 70k records are displayed. I don't have idea why the NIL element in :aDataSets affects my report.
Regards,
Mario

:DelDataSet Question

Posted: Wed Dec 18, 2013 10:55 am
by ignacio
mhsabado escribió el mié, 18 diciembre 2013 05:47
Hi Ignacio,
I have a function in my code that I just passed the dbf files and relations as parameters. Each dbf was added to report as DS. For dbf files that have relations, they were assigned to another DS (i.e., oDS:= :AddDbf(cAlias ,{"cAlias1->*","cAlias2->*"}). Since the related tables have been merge to a separate DS, I wanted to delete the other DS assigned to each individual dbf files to avoid redundancy. Although the MasterData in my report was assigned with DS that has relations, when a NIL exist in the :aDataSets, the report only displays up to 4 pages for the 70k records. If I try to issue ASize() to :aDataSets to eliminate the NIL element, the problem goes away and the 70k records are displayed. I don't have idea why the NIL element in :aDataSets affects my report.
Regards,
Mario

Hi,
If you will not use some DBFs except as a relation then consider to not include them at all on the report. I'm afraid the execution pensalty is on adding a dataset and afterwards destroying it. Once is added is not worth to destroy it.
BTW, try to reproduce your problem with our console demo and I will have a look.
Regards,