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);
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
wrong Code:
TfrReport* frReport = new TfrReport(NULL);
right Code
TfrReport* frReport = new TfrReport(Application);
The component is not correctly initialized, when parameter is NULL.