Repeating a Record Based on a Data Value
Hello,
I would like to repeat the parsing of a record (detail band takes up one
page) a finite number of times as defined by an integer data value contained
in that particular record. Put another way, if a certain integer field in
the record has the value '3', I would like to print three pages with data
corresponding to that record. The only thing in appearance that should
change from one page to the next is the incrementing of a variable that can
be displayed on the page ("This is sample 2 of 3 for this inventory
number."). How do I go about doing this? Thanks for the help.
Stanley
I would like to repeat the parsing of a record (detail band takes up one
page) a finite number of times as defined by an integer data value contained
in that particular record. Put another way, if a certain integer field in
the record has the value '3', I would like to print three pages with data
corresponding to that record. The only thing in appearance that should
change from one page to the next is the incrementing of a variable that can
be displayed on the page ("This is sample 2 of 3 for this inventory
number."). How do I go about doing this? Thanks for the help.
Stanley
This discussion has been closed.
Comments
Depending on how large your detail band is, you could adjust the
DetailBand.BandsPerRecord property to print the correct amound of detail
bands per record to fill the proper amount of pages. For instance if your
integer data value is 3 and you can fit 20 detail bands per page, you would
want to set the BandsPerRecord property to 60.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
follow-up: how can I increment a variable (to be displayed on the report)
for each instance of the band for particular record? I noticed the variable
"BandsPerRecordCount", which I assume has the number in it that I am after,
but how do I update a displayed variable (Variable 1, a string with some
other dynamic text in it) to reflect this for each creation of a band (is
there an "on band create" event somewhere that I am missing?)?
Stanley
Usually for any type of variable manipulation you will want to use the
TppVariable.OnCalc event. However in your case you will probably want to
try to increase the value of the variable inside the DetailBand.BeforePrint
event. On item you will need to be aware of is that the
DetailBand.BeforePrint event can fire more than once per band in some cases
(i.e. page breaks) so it may be necessary to place a check inside this event
before making any calculations.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Please excuse the blatant "newbie" question... but how do I define the
value of this sort of variable outside the Variable1OnCalc function? The
"Variable1.Value := " approach fails on generation of report with
"Couuld not run program: DetailBeforePrint" (even though the type matches).
Thanks Again.
Alright, I am defining the value of the variable with
"Variable1.OnCalc(Variable1.Value);" (is this correct?), but the count
(I am just using "IntToStr(Detail.BandsPerRecordCount)" as part of the
OnCalc function) fails to increment with each new detail band for a
given record. I am calling OnCalc from the DetailBeforePrint. Is there
another DetailBANDBeforePrint somewhere? I appreciate your help.
Stanley
Double check to be sure the types match for the value of the TppVariable.
This is usually the only reason you will receive this error when running
your RAP code. You can post your code here and I'll test it on my machine
if you would like.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Rather than define the value of the variable in the OnCalc event, just
define it in the DetailBand.BeforePrint event. This should work the same in
RAP as it does in Delphi.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I managed to solve this another way because I was overlooking something,
but it is still strange to me that the variable would not assign
properly. The same assignment that in the OnCalc procedure worked
without trouble did not in one of the OnStart procedures (basically
"Variable1.Value := 'Characters' + IntToStr(integerVariable) + 'more
characters';".
Thanks for your help.