Adding multiple vendors on RFQ form through a multiselect form
The form opens as below:
Below is the logic for the ok click :
void clicked()
{
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();//Create instance of class
Set selectedRecords = new Set(Types::Record);//Declare a set of type record
VendTable vendTableLocal; //Your table buffer
Args args = new Args();
super();
selectionHelper.parmDataSource(VendTable_DS); //Set the datasource
vendTableLocal = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)
if (vendTableLocal.RecId)
{
while (vendTableLocal)
{
selectedRecords.add(vendTableLocal);
//info(strFmt('Selected record.. %1',vendTableLocal.AccountNum));//Display selected record
con = conIns(con,1, vendTableLocal.AccountNum);
vendTableLocal = selectionHelper.getNext();
}
}
}
this lookup form will open from RFQ Form in Vendors Tab:
Below is the logic when this menue button is clicked on the Vendor tab and the code opens the lookup form from where we can select multiple vendors and then those vendors are added to the form grid:
void clicked()
{
container con;
int i;
FormRun formRun;
Args args = new Args();
Object objRun;
VendTable tempVendTable;// = VendTable::find(purchRFQVendLink.VendAccount);
//super();
//new MenuFunction(menuItemDisplayStr(AXPRFQVendorLookup), MenuItemType::Display).run();
args.name(formstr(AXPRFQVendorLookup));
//args.record(CustTable::find('ABC'));
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait(true);
objRun = formRun;
con = objRun.getVendAccount();
// string to container
// for sorting
for(i = 1;i<= conLen(con) ;i++)
{
info(conPeek(con,i));
tempVendTable = VendTable::find(conPeek(con,i));
purchRFQVendLink.VendAccount = tempVendTable.AccountNum;
purchRFQVendLink.initFromVendTable(tempVendTable);
purchRFQVendLink.insert();
vendTable.data(tempVendTable);
vendTable_DS.setCurrent();
vendTable_DS.rereadReferenceDataSources();
}
purchRFQVendLink_ds.executeQuery();
}
Comments
Post a Comment