Save The SRS Printer Settings in Table and Re-Use

In this article,

1)      We can store the printer settings of a report in the table, like in parameters table as a container type field. (Section –I)

2)      While printing the reports, we will read the settings from the parameter table and we will apply the same for report printing.  (Section – II)

static void myPrinterSettingsReport(Args _args)

{

SrsPrintDestinationSettings printSettings;

FormRun                     printSettingForm;

boolean                     ok = true;

Args                        args = new Args();

container                   myPrint;

SrsReportRun                        reportRun;

SRSPrintDestinationSettings srsPrintSettings;

//Section – I

//This we can implement on the parameters form by adding button and define this in click event

printSettings = new SrsPrintDestinationSettings();

args.caller(printSettings);

//calling printersettings form

args.name(formstr(SRSPrintDestinationSettingsForm));

printSettingForm = classfactory.formRunClass(args);

printSettingForm.init();

printSettingForm.run();

printSettingForm.wait(true);

ok = printSettingForm.closedOk();

if (ok)

{

//Retrieving printer settings to a container and this container we can store in to a table

myPrint = printSettings.pack();

}

//Section –II

reportRun = new SRSReportRun();

reportRun.reportName(“Vend.Report”);

// Set printersettings

srsPrintSettings = reportRun.printDestinationSettings();

// while generating the report we can read the printersettings from table (container field value) and pass to the following method.

srsPrintSettings.unpack(myPrint);

reportRun.showDialog(false);

reportRun.init();

reportRun.savePrinterSettings(false);

reportRun.saveReportParameters(false);

reportRun.saveReportQueries(false);

reportRun.run();

}


Related
Recommended