PrepareReport() ->Exception "Missing MasterData"

Problem:
Exception "Missing MasterData" when using "PrepareReport" Method

Description:
Our "two-pass" report works fine, when we build it and export it over a form.
We have problems, when we try to export the report over Code. When the "PrepareReport" Method is called then Fastreport makes the first pass and when beginning the second pass it throws an exception:
"Project sked.exe raised exception class EClassNotFound with Message 'Missing MasterData'. Process stopped. Use Step or Run to Continue."
Then another MessageBox comes: "Missing MasterData".

MasterData is the Name of the MasterBand, to which we refer by Code within the On BeforePrint-Event at the second pass.

Code:
TfrExportFilter* FRTF_exp = new TfrRTF_rsExport(NULL);
FRTF_exp->ShowDialog = false;

TfrReport* frReport = new TfrReport(NULL);
frReport->ShowProgress = true;
frReport->LoadFromFile(SkedFileNames::FILENAME_REPORT_MODULE());
SetPortraitPageOrientation(frReport);
if(frReport->PrepareReport()) <---Exception
frReport->ExportTo(FRTF_exp, DateiName);

Comments

  • edited 9:27AM
    We solved the problem:

    wrong Code:
    TfrReport* frReport = new TfrReport(NULL);

    right Code
    TfrReport* frReport = new TfrReport(Application);

    The component is not correctly initialized, when parameter is NULL.

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.