More functions!

Hello,
I want use IncYear() in FastReport but this function not found.

I try this:

USES DateUtils;

but get a error.
Can I use external functions or Delphi functions in FastReport

Thanks.

Comments

  • edited 9:12AM
    Please read the "developer manual".
  • edited 9:12AM
    Thank you.
    In source below I add Delphi IncYear() function and DateFormat for FormatDateTime(), but I have problem.
    When start report first time all is ok, but when start second time get a error: "Could not convert variant of type (Null) into type (Double)".

    Do u have any idea, how to fix this problem?
    Thank you.


    function TForm69.m_FDate: String;
    begin
    Result := 'dd' + DateSeparator + 'mm' + DateSeparator + 'yyyy';
    end;

    function TForm69.m_IncYear(dDate, nInc: Variant): Variant;
    begin
    Result := IncYear( dDate,nInc );
    end;

    function TForm69.frxReport1UserFunction(const MethodName: String;
    var Params: Variant): Variant;
    begin
    If MethodName = 'M_INCYEAR' Then
    Result := m_IncYear( Params[0],Params[1] );
    If MethodName = 'M_FDATE' Then
    Result := m_FDate;
    end;

    procedure TForm69.FormShow(Sender: TObject);
    begin
    Form69.frxReport1.AddFunction('function m_IncYear(dDate, nInc: Variant): Variant');
    Form69.frxReport1.AddFunction('function m_FDate : String');
    Form69.frxReport1.LoadFromFile( 'cit0002.fr3' );
    end;


    in report 'cit0002.fr3'

    begin
    memo72.text := 'Date: ' + FormatDateTime( m_FDate,m_IncYear(StrToDate(<frxDBDataset1."D_NOMER">),1) );
    end.
  • edited 9:12AM
    ????
  • edited 9:12AM
    Probably <frxDBDataset1."D_NOMER"> is Null in some cases, you should check it for Null.
  • edited 9:12AM
    Hello Alex,
    I check all date fields and all is filled!

    I use and other function that fill '0' before number, but this also work only first time on the second get a error!

    In 3.03 and 3.04 not work.
    Maybe I have to free functions and create it again, but how to do that? Any ideas?

    If u have sample where send u?
    Thanks.
  • edited 9:12AM
    Send me a demo, I will check it.
    tz@fast-report.com

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.