Pass paramater and output settings to a report through X++

I’m currently attempting to setup a system that will generate a number of CSV’s based on what tick boxes are clicked on a new form.

This report will only ever be run from this form and will only ever run as CSV to pre specified file names in a pre specified folder. I can run the report from the form without problems with the dialogue suppressed but I can’t figure out how to set parameters and print settings through X++.

Can anyone help?

Hi,

Take a look at this.

SrsReportRun srsReportRun;

srsReportRun = new SrsReportRun(‘YourReport.YourDesign’);

srsReportRun.init();

srsReportRun.reportCaption(“Test”);

srsReportRun.showDialog(false);

srsReportRun.reportParameter(“YourReportParameterName”).value(“ParameterValue”);

srsReportRun.printDestinationSettings().printMediumType(SRSPrintMediumType::File);

srsReportRun.printDestinationSettings().fileFormat(SRSReportFileFormat::CSV);

srsReportRun.printDestinationSettings().fileName(‘YourFileName’);

srsReportRun.printDestinationSettings().numberOfCopies(2);

if( srsReportRun )

{

srsReportRun.executeReport();

}

Thanks for the reply.

Since the report I’m using has it’s own custom contract class I’ve had some success setting up an instance of that, setting up my parameters in there and then passing it to the controller class through the contract parm method. Seems to be the same logic as your method though just preloading the same settings into a contract and passing that to the controller.