Hi
I am able to pass single parameter from one form to other from the below code.Please send the code to pass multiple parameter using the below method.
void clicked()
{
Args _args;
FormRun _formRun;
ItemRelation _ItemRelation;
AccountNum _accountnum;
PriceDiscAdmTrans apricediscadmtrans;
;
_ItemRelation = PriceDiscAdmTrans.ItemRelation;
_accountnum = PriceDiscAdmTrans.AccountRelation;
apricediscadmtrans = pricediscadmtrans_ds.getFirst(true);
_args = new Args();
_args.name(formstr(GACC_PurchPriceHist));
_args.caller(this);
_args.parm(_ItemRelation);
_args.parm(_accountnum);
_args.record(PriceDiscAdmTrans);
_formRun = ClassFactory.formRunClass(_args);
_formRun.init();
_formRun.run();
_formRun.wait();
_args.parmObject( _args );
}
public void init()
{
Query query;
QueryRun queryRun;
QueryBuildDataSource qbds;
QueryBuildRange qbr,qbr1;
;
switch(element.args().dataset
{
case tablenum(PriceDiscAdmTrans):
{
_ItemRelation = element.args().parm();
_accountnum = element.args().parm();
query = new Query();
qbr = query.addDataSource(tablenum(PriceDiscAdmTrans)).addRange(fieldnum(PriceDiscAdmTrans,ItemRelation));
qbr1 = query.addDataSource(tablenum(PriceDiscAdmTrans)).addRange(fieldnum(PriceDiscAdmTrans,AccountRelation));
info(PriceDiscAdmTrans.getSQLStatement());
PriceDiscAdmTrans_ds.query(query); // execution of the query
break;
}
}
super();
}
Thanks
*This post is locked for comments
I have the same question (0)Well, you can use args.parmObject(), generally speaking, or just reference a specific method on the caller, that would return a container or whatever collection object you want, and invoke it from the called form through element.args().caller().
However, in your case, you pass in the record buffer PriceDiscAdmTrans, so maybe you can just rely on element.args().record() in the called form to get the two field values?
Through the map, it could look like this:
Map filters = new Map(Types::Int64, Types::String);
Args args = new Args();
filters.insert(fieldNum(PriceDiscAdmTrans, ItemRelation), 'some value');
filters.insert(fieldNum(PriceDiscAdmTrans, AccountRelation), 'some 33');
args.name(formStr(Form1));
args.parmObject(filters);
Note, however, that passing in object references is usually more error-prone than value types.