Hi
I am trying to create a report using X and saving it as a file but I am having a few problems.
First of all: setting the srsPrintDestinationSettings.fileName does nothing at all. No file is written.
SalesPackingSlipJournalPrint salesPackingSlipJournalPrint;
Set set = new Set(Types::Record);
SRSPrintDestinationSettings srsPrintDestinationSettings;
str directory;
// Add record
set.add(custPackingSlipJour);
// Set printer settings
srsPrintDestinationSettings = new SRSPrintDestinationSettings();
srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::File);
srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::PDF);
srsPrintDestinationSettings.overwriteFile(true);
srsPrintDestinationSettings.fileName(filename);
// Initalize
salesPackingSlipJournalPrint = SalesPackingSlipJournalPrint::construct();
salesPackingSlipJournalPrint.parmPrintFormletter(NoYes::Yes);
salesPackingSlipJournalPrint.parmUsePrintManagement(false);
salesPackingSlipJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack());
// Print
salesPackingSlipJournalPrint.printJournal(set);
This code generates the correct report with data but I am unable to save it to disk.
Then I tried this code:
SrsReportRunController ssrsController = new SrsReportRunController();
SalesPackingSlipContract salesPackingSlipContract = new SalesPackingSlipContract();
SRSPrintDestinationSettings printerSettings;
ReportName reportName = "NCCSalesPackingSlip.Report";
ssrsController.parmReportName(reportName);
ssrsController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
ssrsController.parmShowDialog(false);
salesPackingSlipContract.parmRecordId(custPackingSlipJour.RecId);
ssrsController.parmReportContract().parmRdpContract(salesPackingSlipContract);
printerSettings = ssrsController.parmReportContract().parmPrintSettings();
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.overwriteFile(true);
printerSettings.fileName(filename);
ssrsController.runReport();
This code generates the correct report but it is empty! Also no file is written to disk.
Whys is my report empty? What am I doing wrong?
regards
Peter