Custom Function
I've added a function, that does show up on the report designer's function tab, in my new group 'SimpleLandlord Functions'
On a field on the report changed the code in the OnBeforePrint Event to:
On the form with the report component I changed the frxReportUserFunction to:
But when I run the report I get the error:
Do you know what I have done wrong?
procedure TfraReportPicker.btnDesignClick(Sender: TObject);
begin
  frmReportViewer.frxReport.AddFunction('function fmtCur(c: Currency; IncludeCurrencySign: Boolean = True): String', 'SimpleLandord Functions');
  frmReportViewer.frxReport.DesignReport();
end;
On a field on the report changed the code in the OnBeforePrint Event to:
procedure frDsReportAmount1OnBeforePrint(Sender: TfrxComponent);
begin
      fmtCur(<frDsReport."Amount">, True);                                     Â
end;
On the form with the report component I changed the frxReportUserFunction to:
function TfrmReportViewer.frxReportUserFunction(const MethodName: string; var Params: Variant): Variant;
var
  c: Currency;
begin
  if (MethodName = 'fmtCur') then
  begin
    c      := Params[0];
    Result := fmtCur(c);
  end;
end;
But when I run the report I get the error:
---------------------------
Debugger Exception Notification
---------------------------
Project SimpleLandlord.exe raised exception class Exception with message 'Undeclared identifier: 'fmtCur''.
---------------------------
Break  Continue  Help Â
---------------------------
Do you know what I have done wrong?
Comments
Thanks, I tried that, but I am not even hitting the function: (OnUserFunction)
function TfrmReportViewer.frxReportUserFunction(const MethodName: string; var Params: Variant): Variant;
I set a break point here and it never go to it.
in the OnUserFunction I have the code:
Is that what you mean?
In case anyone wanted to know the logic I was using did not go through the code to add the function.
Sorry for the inconvenience.