2.22. How to use own function?Use TfrReport.OnUserFunction event. Here is simple example:procedure TForm1.frReport1UserFunction(const Name: String; p1, p2, p3: Variant; var val: Variant); begin if AnsiCompareText('SUMTOSTR', Name) = 0 then val := My_Convertion_Routine(frParser.Calc(p1)); end;After this, you can use SumToStr function in any place of report (in any expression or script).
2据我所知,fr3的确能够添加8个自定义函数,不过没有试过,如果实在找不到,可以试试在调用的时候修改数据集,我们以前就是这样做的。
p1, p2, p3: Variant; var val: Variant);
begin
if AnsiCompareText('SUMTOSTR', Name) = 0 then
val := My_Convertion_Routine(frParser.Calc(p1));
end;After this, you can use SumToStr function in any place of report
(in any expression or script).