Use Script variables :error opening stored report

diaswdiasw Germany
edited 10:29AM in FastReport 3.0
FR 3.08, D7.
I have a dot-matrix-report with dmpmemo-fields, filled by Datasets.
A special-field ist filled with the content of a variable ('endtext'), as I have to replace some data in the field before printing (string-Field with text and some placeholders, e.g. #d# for date or #p# for provision). In this field there are also breaklines (#13#10), so I cannot use a Report Variable. I tried script variable instead.
It works well when I print immediately or if I go to preview, but in case that I store the report and reopen it, an error occurs: the script variable 'endtext' is unknown.
I thought that a prepared and stored report only stores plain text/plain report commands and doesn't recalc/regenerate the report?

my commands to gen the rep are:

LoadFromFile -> get Template
Set Script.Variables- value (replaced string)
PrepareReport
SaveTofile

For loading the generated Report:
LoadFromFile
Set DotMatrixReport = True
ShowReport -> Error occurs

Of course, I could use the replace-procedure in the report itself. But I need it in about 6 Reports, so I had to make much more efforts in changemanagement.

Any suggestions how to avoid that the script-variable will be necessary?

Thanks

Sascha



;)

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 10:29AM
    viewing a previously saved fp3 report
    frxreport1.Clear;
    frxreport1.PreviewPages.LoadFromFile('path+filename.fp3');
    frxreport1.ShowPreparedReport;

    ;)
  • diaswdiasw Germany
    edited 10:29AM
    got it now, thanks.

    had two errors:
    big first: I saved the template, not the prepared report (frxRep.previewpage.SavetoFile)

    second: I opened it as template, not as preparedreport (as you mentioned).

    thank you

    Sascha
    ;)

Leave a Comment