Recent

Author Topic: Lazreport page count issue when using TfrUserDataset and ongetvalue[SOLVED]  (Read 4070 times)

snorkel

  • Hero Member
  • *****
  • Posts: 796
Laz 1.0.4 32bit
Windows 7 64bit

I built a report using the TFrUserDataset and the reports on get value event.
I have the multi pass report option set to true and when I print the report
the page footer on the last page shows no page number, the first 3 pages show the number, but not the fourth.

If the report data is small and fits on a singe page the page number is again not shown.

Also when using the Report Title band it does not pick up values from OnGetValue.

These issues do not appear when using the TfrDBDataset component.

I guess I could be doing something wrong, but I think it's a bug.

Comments? Suggestions?
« Last Edit: December 08, 2012, 06:59:23 pm by snorkel »
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 1.8 and FPC 3.0.4
OS: Windows 10 64 bit

sylvanus67

  • New Member
  • *
  • Posts: 25
Re: Lazreport page count issue when using TfrUserDataset and ongetvalue
« Reply #1 on: December 07, 2012, 06:42:14 pm »
Do you checked on Page footer "On last page" checkbox?

snorkel

  • Hero Member
  • *****
  • Posts: 796
Re: Lazreport page count issue when using TfrUserDataset and ongetvalue
« Reply #2 on: December 07, 2012, 07:01:37 pm »
Yes, on first page and on last page is checked.

It works fine when I use the TFRDBDataset, so I could copy the data from the array into a tmemorydataset and use that, but that's a lot of extra overhead just to get the page number on the last page.

The "almost" exact same code works on delphi in Fastreport, so it's probably a safe bet its a bug that existed in the original fast report code that lazreport is based from.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 1.8 and FPC 3.0.4
OS: Windows 10 64 bit

paweld

  • Full Member
  • ***
  • Posts: 186
Re: Lazreport page count issue when using TfrUserDataset and ongetvalue
« Reply #3 on: December 07, 2012, 07:20:30 pm »
examle code and report?
Best regards
paweld

snorkel

  • Hero Member
  • *****
  • Posts: 796
It's not a bug, just a difference in how the page variable works between Lazreport and fastreport

 if CompareText(parName, 'username') = 0 then
        ParValue:= 'This is a test bla bla bla'
         else parvalue:='';    <---this causes the page number to be over written with a blank   

Apparently LazReport generates the page number before the OnGetValue, and having the line above sets the last page# or the first page# if only one page to  blank.   


***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 1.8 and FPC 3.0.4
OS: Windows 10 64 bit