Search This Blog

Monday, 13 October 2014

Passing multiple selected record as a parameter form Form to Report

Hi ,

Today i would like to share, how to pass multiple selected record from Form as a parameter to
Report

step 1 : 

write this piece of code in the clicked of the button

void clicked()
{
    CustTable  custTable1;
    container   con;
    Args        args;
    str         multiSelectString;
    args = new Args();
    custTable1= CustTable_ds.getFirst(1);
    while (custTable1)
    {
        // storing recid of selected record in container
        con = conIns(con,1, custTable1.AccountNum);
        // converting container to string with comma separated
        multiSelectString = con2Str(con,',');
        custTable1= CustTable_ds.getNext(); // moves to next record
    }

    // passing string
    args.parm(multiSelectString);
    // calling menu item
    new MenuFunction(menuitemOutputStr(SampleReport), MenuItemType::Output).run(args);
}

step 2 :

write this piece of code in the init method of the report and change the query property userupdate as no



public void init()
{
   str multipleRecords;
    super();
    multipleRecords = element.args().parm();
  this.query().dataSourceTable(Tablenum(CustTable)).addRange(fieldNum(CustTable,AccountNum)).value(multipleRecords);
}

Happy Daxing....

No comments:

Post a Comment