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

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 12:13AM
    hi
    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 ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.