Reportbuilder 19.04 TppReport is grabbing data via pipeline more than once even though it's onepass
History of this issue:
Basically depending on the configuration of the rtm (set to onepass), the datapipeline's getfieldvalue event is firing 3 times. This has thrown out printing barcodes (see this thread- http://www.digital-metaphors.com/forums/discussion/comment/50377#Comment_50377).
Current issue:
Another configuration has broken this fix as the pipeline's getfieldvalue event fires only twice in this scenario. Why is this event firing multiple times and a different amount of times depending on the rtm layout (dbtext vs calc field)??? In rb 7 it fired only once (I'm assuming that was the pass setting coming in to play). Note this is when printing multiple copies of the same report in one TppReport.print and for each copy it grabs the data 2 or 3 times via getfieldvalue, rather than once.
I've used the OnTraverseBy event to implement a fix as it seems to consistently have aIncrement := 1 when it goes to the next report/record. I have noticed this takes a value of -1 which implies it's moving to the prior record (why is this?).
Thanks!
Basically depending on the configuration of the rtm (set to onepass), the datapipeline's getfieldvalue event is firing 3 times. This has thrown out printing barcodes (see this thread- http://www.digital-metaphors.com/forums/discussion/comment/50377#Comment_50377).
Current issue:
Another configuration has broken this fix as the pipeline's getfieldvalue event fires only twice in this scenario. Why is this event firing multiple times and a different amount of times depending on the rtm layout (dbtext vs calc field)??? In rb 7 it fired only once (I'm assuming that was the pass setting coming in to play). Note this is when printing multiple copies of the same report in one TppReport.print and for each copy it grabs the data 2 or 3 times via getfieldvalue, rather than once.
I've used the OnTraverseBy event to implement a fix as it seems to consistently have aIncrement := 1 when it goes to the next report/record. I have noticed this takes a value of -1 which implies it's moving to the prior record (why is this?).
Thanks!
Comments
The DataPipeline.GetFieldValue is not guaranteed to fire only once (or a certain number of times) per record. ReportBuilder is constantly moving forward, backward, and repeatedly retrieving data in a dataset to facilitate page navigation, value caching, calculations, threading features, etc., hence the occasional -1 value for OnTraverseBy. The same would apply when using OnRecordPositionChange.
If an event is needed to fire only once per record, I suggest using the TppVariable.OnCalc event with a numerical type variable. This is the only event that is guaranteed to fire only once per record and is the only event that is safe to make calculations in during report generation.
Again, I highly recommend upgrading to the latest version of ReportBuilder (21.02).
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks again for your quick reply.
Is it possible to do this in a more general way at runtime (ie independent of the rtm/report)?
Ie is there an event fired only once each time you change to the next record (other than seemingly using OnTraverseBy where moveby=1, though by the sounds of it this may break for more complex rtms).
ReceiptPipeLineTraverseBy(aIncrement: Integer);
begin
if aIncrement=1 then
doStuff;
end;
If there isn't a solution at the moment, would it be possible to include this in a future release?
I believe a bit more information about your exact requirements would be helpful in recommending a solution.
1. What would you like to happen during "doStuff"?
2. As I mentioned before, ReportBuilder is constantly moving forward and backward in the dataset. Your code above may work for some cases but what happens when a user pages backward when viewing?
Depending on what you are trying to accomplish, it appears pre-processing outside the report may be the best option for this case.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
We just want to change a variable in a an array to true each time that particular copy of the report is printed. The report isn't previewed and is very simple, a few dbtext fields and a dbbarcode or barcode with it's value generated from the pipeline via code (Barcode.Data := pipeline['field']; etc).
A bunch of these are printed at the same time and they will all have different barcode values from the pipeline.
Is there an event fired after each print?
If you are making a call to Report.Print on a loop and need to perform an operation for each report, you can try using the Report.AfterPrint event.
From your description, it appears you may have a Master-Detail relationship (one master record for each report and accompanying detail data inside each report). In this case you may be better off using a group, and altering the variable array in the OnGroupBreak event.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com