error in sum on headerband

edited May 2017 in FastReport 4.0
hello, ihave FR 4.15
double pass is set to true

i know example in documentation of sum on header
accordint to this, i have:

procedure GroupHeader5OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass then
begin
memo49.text:=(get('SUMMD'));
end;
end;

procedure GroupFooter5OnBeforePrint(Sender: TfrxComponent);
var
b:currency;
begin
Set('SUMMD',(<SUM(<frxDBDataset1."CASTKA_MD">,MasterData1)>));
end;


field "CASTKA_MD" is ftcurrency,12,2
allways i get error Couldnt convert variant of type (Null) into type Olestr



but if i try:
procedure GroupFooter5OnBeforePrint(Sender: TfrxComponent);
var
b:currency;
begin
Set('SUMMD',(<frxDBDataset1."CASTKA_MD">));
end;


i have no error, of cource i get last value of field CASTKA_MD, no SUM but it means that system of SET and GET works well.
any IDEA?
txh

Comments

  • gpigpi
    edited 6:17AM
    Attach your report template (fr3) here
  • edited May 2017
    fr3 in attachment
    thank you
  • edited 6:17AM
    i don't understand you well

    target object of sum is memo49, and it is text object, or where should be text object placed?
    and should be filled in design with SUM?


    thx for your time
  • edited May 2017
    so, i have progress.
    i put invisible tfrxmemoview to groupfooter, fill it with SUM and it works now,
    sum is showen in groupheader

    BUT

    sum of group is written to header of next group not to same header


    any suggestion?
    thx
  • gpigpi
    edited 6:17AM
    You should use unique report variable name for each group
  • edited 6:17AM
    meanwhile i get known it, and its logic
    after change variable name to unique name for each group
    nothing changed, sum is still on next header
  • gpigpi
    edited May 2017
    wrote:
    after change variable name to unique name for each group
    nothing changed, sum is still on next header
    Do you use
    'SUMMD' + VarToStr(<frxDBDataset1."STRED">) + VarToStr(Trunc(<frxDBDataset1."UCET">/1000000)) + VarToStr(Trunc(<frxDBDataset1."UCET">/100000>)) + VarToStr(Trunc(<frxDBDataset1."UCET">/1000)) + VarToStr(<frxDBDataset1."UCET">)
    variable name?
    Attach your current report template (fr3)
  • edited 6:17AM
    i got it now

    before, i use only group5 condition <frxDBDataset1."UCET">
    i have changed it to all groups condition as you said and it works now

    thank you very much for your time and help

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.