Hi All,
I have a requirement, for that I have to show all the lines of “Lines” tab of “VendInvoiceJournal” form on a new form(lets say it “MaintainChargesFrm”), and have to implement some more functionality (leave that, for now I have to show only some field of all the lines of “Lines” tab of “VendInvoiceJournal” form in a grid of “MaintainChargesFrm” form ). I have added a button as “Maintain Charges” On “VendInvoiceJournal” form (as shown in the attached pic), and on the click of that button, the newly created form should open with all the records as of “Lines” tab of “VendInvoiceJournal” form.
For now, on the click of “Maintain Charges” button, the form “MaintainChargesFrm” opened but no record shown.
I have written the code on Clicked() method of the button as below:
void clicked()
{
int recordsCount;
VendInvoiceTrans _vendInvoiceTrans;
container con;
Args args;
str multiSelectString;
args = new Args();
recordsCount = VendInvoiceTrans_ds.recordsMarked().lastIndex(); // gets the total records selected
_vendInvoiceTrans = VendInvoiceTrans_ds.getFirst(1);
while (_vendInvoiceTrans)
{
// storing recid of selected field in container
con = conIns(con, 1, _vendInvoiceTrans.RecId);
// converting container to string with comma separated
multiSelectString = con2Str(con, ‘,’);
_vendInvoiceTrans = VendInvoiceTrans_ds.getNext(); // moves to next record
}
// passing string
args.parm(multiSelectString);
// calling menu item
new MenuFunction(menuitemDisplayStr(OWMaintainCharges_MI), MenuItemType::Display).run(args);
}
And the code for init() method of the newly created form (“MaintainChargesFrm” form) is as below:
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++)
{
VendInvoiceTrans_ds.query().dataSourceTable(Tablenum(VendInvoiceTrans)).addRange(fieldNum(VendInvoiceTrans, RecId)).value(SysQuery::value(conPeek(con,i)));
}
}
Please help me to sort out the problem.
Thank You!!!