Passing Multiple Records from Form to SSRS Report in AX

Step 1: Input Form: Create an Input Form as given below this will act as first step.

Step 2: Button Clicked: Create a Button which will contain a clicked method which can help in transferring data(records) from form to reports.

void clicked()
{
CustTable    custTable1;
container    con;
Args         args;
str          multiSelectString;

ReportRun reportRun;

args = new Args();

while select custTable1 where custTable1.Checker==boolean::true
{

//Checker is our field

con = conIns(con,1, custTable1.AccountNum);

multiSelectString = con2Str(con, ',' );

}

args.parm(multiSelectString);

args.name(reportstr(ReportCusty_GV));

//ReportCusty_GV is Report Name.

reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportRun.run();
}

Step 3: Create a Report with necessary designs.

Step 3.1: Init Method: Write the below mentioned code in init() method to get values from the form.

public void init()
{
str multipleRecords;

super();

multipleRecords = element.args().parm();
this.query().dataSourceTable(Tablenum(CustTable)).addRange(fieldNum(CustTable,AccountNum)).value(multipleRecords);

}

Comments

Post a Comment