Variables in Report Name (ReportOptions.Name)

edited 5:12AM in FastReport 4.0
I have the following problem:

I found the Name property of FR document (Report.ReportOptions.Name) or MenuBar/Report/Property/Description/Name.
I can set it there and when i open Print Preview-> print PDF (i use FreePDF) the name of the document is how i called it! If i let these fields free, its default "Fast Report Document"

My problem is that i want to do a composite name out of a string and a variable:
Report.Name := 'Invoice_' + <frx_rep01."MASKENKEY">;

Is it even possible to do a composite report name for the pdf with a variable and how does it work? And in which procedure i have to do it?

I tried it in:
Page1OnBeforePrint
frxReport1OnReportPrint

Thx for your help!

Comments

  • gpigpi
    edited 5:12AM
    Use custom user function and change Report.ReportOptions.Name in the Delphi's code
  • ksihotaksihota Victoria, BC Canada
    edited December 2014
    Try
    frxreport.Report.FileName:='Invoice_' + <frx_rep01."MASKENKEY">;

    Kim
  • edited December 2014
    i now definitaly found the right way to change the name of the document:

    procedure frxReport1OnReportPrint(Sender: TfrxComponent);
    begin
    Showmessage(Report.Reportoptions.Name);
    Report.Reportoptions.Name := ''''+'Auftragsbestaetigung_'+<frx_rep01."MASKENKEY">+'''';
    Showmessage(Report.Reportoptions.Name);
    end;

    First Line, the name of my Report is shown. I named it in Report/Reportoptions/Name "Test123" (my messagebox confirms that to me)
    Second Line, i rename the ReportName (my messagebox in Line3 confirms the Report.Reportoptions.Name to "Auftragsbestaetigung_12345678"

    But if i press the Print Button in Fastreport and go to Printer "FreePDF", then the Filename is mentioned there as "Test123" again.

    I tried to put the code in different procedures of "Page" and "Report", but still the "old" name occurs.

    Where do i need to change the name that it is changed before FreePDF tooks the name? What is the first procedure of all? (i guess onReportPrint (Report) or OnBeforePrint (Page))
    Is it even possible to change a property value of the report in code so the changed value will be used when (in my case) i want to save the report as pdf. I guess the value of Name is saved somewhere before and will be used, no matter if we change it in code.
  • edited 5:12AM
    gpi wrote: »
    Use custom user function and change Report.ReportOptions.Name in the Delphi's code

    What do you mean in Delphis code? You mean before FR is starting, i have to change it in the Software which calls the FastReport (in my case AVERP ERP)?
    The renaming is working (see my other post), but still the name is not taken by the Printer FreePDF.
  • gpigpi
    edited 5:12AM
    Try to call
    Report.Reportoptions.Name := ''''+'Auftragsbestaetigung_'+<frx_rep01."MASKENKEY">+'''';
    in the main procedure of the report script
    begin
    Report.Reportoptions.Name := ''''+'Auftragsbestaetigung_'+<frx_rep01."MASKENKEY">+'''';
    end.
    
  • edited 5:12AM
    gpi wrote on Dec 17 2014, 06:07 AM:
    Try to call
    Report.Reportoptions.Name := ''''+'Auftragsbestaetigung_'+<frx_rep01."MASKENKEY">+'''';
    in the main procedure of the report script

    i tried it in the main, but it still does not work. Or, to say it correctly, the renaming does work (tried it with messageboxes, Showmessage(Report.Reportoptios.Name) after renaming brings me the changed name), but the name which is given to the Print Men?? (Printer/Printername:FreePDF/Name) is still the old value of Report.Reportoptions.Name

    I hope you have any other ideas. Thx for your thoughts
  • edited 5:12AM
    Problem solved:

    The name has to be defined in AverpDesigner in Objectinspector/FormShow and not in the FastReport Designer.

    I put following code in FormShow and it worked:
    q_rep1.open();
    frxReport1.ReportOptions.Name := 'Name_'+AsString(q_rep1.FieldByName('MASKENKEY'));
  • edited 5:12AM
    plwo wrote: »
    Problem solved:

    The name has to be defined in AverpDesigner in Objectinspector/FormShow and not in the FastReport Designer.

    I put following code in FormShow and it worked:
    q_rep1.open();
    frxReport1.ReportOptions.Name := 'Name_'+AsString(q_rep1.FieldByName('MASKENKEY'));

    Hello there! I am trying to accomplish this exact same thing and I am having the same frustrating results.
    Will someone please help?

    What do you mean by "AverpDesigner" ?

  • edited 5:12AM
    Is there anyone that can chime in on this?

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.