SUM with parameter
Hello.
What can i do to sum with parameter ?
Want sum field "Wart".
If other field "Group"<6 then i need sum "Wart" , but if "Group">=6 i need sum (-1*"Wart").
I puted code to event onbeforeprint:
var
war:Extended;
begin
war:=0;
if (<frxD1."Group"> <6) then war:=SUM(<frxD1."Wart">,MasterData1)
else war:=SUM(-1*<frxD1."Wart">,MasterData1);
TfrxMemoView(Sender).Text:=Format('%2.2n',[war]);
end;
but it doesnt work.
What can i do to sum with parameter ?
Want sum field "Wart".
If other field "Group"<6 then i need sum "Wart" , but if "Group">=6 i need sum (-1*"Wart").
I puted code to event onbeforeprint:
var
war:Extended;
begin
war:=0;
if (<frxD1."Group"> <6) then war:=SUM(<frxD1."Wart">,MasterData1)
else war:=SUM(-1*<frxD1."Wart">,MasterData1);
TfrxMemoView(Sender).Text:=Format('%2.2n',[war]);
end;
but it doesnt work.
Comments
[SUM(IIF(<frxD1."Group"> < 6, <frxD1."Wart">, (-1) * <frxD1."Wart">), MasterData1)]
Thank you.
Used preview this metod , but why didnt work in event obp ?
2. The construction seems to me as it can not get real value of SUM().
Pay attention to what Gpi showed: the whole expression SUM(...) is included in square brackets.
Mick