Passing Multiple Values Using Args Concept

 Here the code snippet,  For passing the multiple selected records from one to another form by using args.

    here im using multiselctionhelper class to get the selected records . 

   To pass the records from one form to another form based on the button click.add below code in the clicked method of parent form button control.

Parent form :

void clicked()

{


     //int recordsCount;

     DAXVendor vendorLoc;

     container con;

     Args args= new Args();

     str multiSelectString;

    MultiSelectionHelper helper = MultiSelectionHelper::construct();

    helper.parmDatasource(DAXVendor_ds);

    vendorLoc = helper.getFirst();


     while (vendorLoc)

     {

     // storing recid of selected field in container

      con = conIns(con,1,vendorLoc.VendorNumber);

     //// converting container to string with comma separated

      multiSelectString = con2Str(con,',');

      vendorLoc = helper.getNext();

     }

     //// passing string

     args.parm(multiSelectString);

     //// calling menu item

     new MenuFunction(menuitemDisplayStr(DAXVendorDetailstest), MenuItemType::Display).run(args);


}

       after getting the values we should pass the values to the child form.for that we have wright the code in child form init method

 child form:

public void init()

{

    container   con;

    int         i;

    str         multipleRecords;

    super();

// getting string value from caller

    multipleRecords = element.args().parm();


// string to container

    con = str2con(multipleRecords,",");


// for sorting

    for(i = 1;i<= conLen(con) ;i++)

    {                   DAXVendorDetails_ds.query().dataSourceTable(Tablenum(DAXVendorDetails)).addRange(fieldNum(DAXVendorDetails,VendorNumber)).value(SysQuery::value(conPeek(con,i)));

    }


}

       






 

No comments:

Post a Comment