Keeping a value
Hi,
I'm trying to keep a value until the next record in order to calculate the difference:
Record 1 Value=900 Difference=0
Record 2 Value=1000 Difference=100
Record 3 Value=1400 Difference=400
.... therefore I'd have to store the value when a master band is printed and return it when the next band is printed.
I could use OnBeginBand to check wether a new MasterBand is printed, store the value in a TForm's property and return it as a variable via OnGetValue.
But I wonder if this would be possible using FR's included language - this way the end-user could easily change the way this "difference" is calculated...
Kind regards,
Mark
I'm trying to keep a value until the next record in order to calculate the difference:
Record 1 Value=900 Difference=0
Record 2 Value=1000 Difference=100
Record 3 Value=1400 Difference=400
.... therefore I'd have to store the value when a master band is printed and return it when the next band is printed.
I could use OnBeginBand to check wether a new MasterBand is printed, store the value in a TForm's property and return it as a variable via OnGetValue.
But I wonder if this would be possible using FR's included language - this way the end-user could easily change the way this "difference" is calculated...
Kind regards,
Mark
Comments
yes you can create an array variable and an index variable write code in the obpevent of the masterdataband to do the swapping.
ie somewhere before mdband set index to 0 title band obp event.
I := 0;
in obpevent of mdband add code
begin
inc(I); //increment index
myarr := [tblname."fieldname"]; // put value in indexed array
if [Line#] = 1 then difference := 0
else difference := myarr[Line#] - myarr[[Line#]-1];
end;
regards