script calcing problem
ibrahim bulut
turkey
hi folks,
i am trying to calculate(sum) a field value within a script but i can not success.
my code is that
procedure ReportSummary1Onbeforeprint(Sender : TfrxComponent);
Var Total : Double;
begin
Total:=Sum(<frxdbdataset1."field1">);
// result is always null, but fields has values.
// memo component which uses the same expression no problem i can see the total.
// also i tried report.calc metod but no success. what i must do
end;
i am trying to calculate(sum) a field value within a script but i can not success.
my code is that
procedure ReportSummary1Onbeforeprint(Sender : TfrxComponent);
Var Total : Double;
begin
Total:=Sum(<frxdbdataset1."field1">);
// result is always null, but fields has values.
// memo component which uses the same expression no problem i can see the total.
// also i tried report.calc metod but no success. what i must do
end;
Comments
select your memoview rtclick edit use the aggregate expression builder.
i don't want to do it in a memoview. it's in the script.
and my expression is working good in a memoview.
i want to do it in a summary band before print event.
also i tried the sum function with band parameter
Total:=Sum(<frxdbdataset1."field1">,Masterdata1) and // always null
Total:=Sum(<frxdbdataset1."field1">,Masterdata1,1) // always null
i tried with report.calc function but result is null
i think, there is a limitations with aggregate functions in the script.
if you would read the manuals you would Know about the limitations.
if you want to use script declare your variable in the correct place and use the crooect obp of the correct band.
var
Total: double;// global available to all events in the report at top of code page
obp of masterdata
Total := Total + <datasetname."fieldname">;
begin
Total := 0; // initialize in the default block or in onstart treport event
end.
i have read the manuels and i can not see any limitations about this.
please write me where is the limitations
i thinks the problem is about aggregate function.
i can do it now with fastreport 2,5.
i can get total with TOTAL:=[SUM(QUERY1."FIELD1")];
"Using aggregate functions in the script"
i will check it