for selecting multiple look up values.
UIbuilderclass is must and use list in contract class
class IntercompanyReportUIBuilder extends SysOperationAutomaticUIBuilder
{
IntercompanyReportContract contract;
DialogField mainAccountLoc,fromdate,toDate;
SysLookupMultiSelectGrid grid;
}private void accountNumLookup(FormStringControl _lookup)
{
Query query = new Query();
QueryBuildDataSource queryBuildDatasource,queryBuildDatasource1;
SysTableLookup sysTableLookup;
MainAccount MainAccount;
if(_lookup!= null)
{
grid = SysLookupMultiSelectGrid::construct(_lookup , _lookup);
//sysTableLookup = SysTableLookup::newParameters(tableNum(MainAccount), _lookup);
//sysTableLookup.addLookupfield(fieldNum(MainAccount,MainAccountId),true);
//sysTableLookup.addLookupfield(fieldNum(MainAccount,Name));
queryBuildDatasource = query.addDataSource(tableNum(MainAccount));
queryBuildDatasource1 =queryBuildDatasource.addDataSource(tableNum(LedgerChartOfAccounts));
queryBuildDatasource1.addRange( fieldNum( LedgerChartOfAccounts, Name)).value("India");
queryBuildDatasource1.joinMode(JoinMode::InnerJoin);//
queryBuildDatasource1.addLink(fieldNum(MainAccount, LedgerChartOfAccounts), fieldNum(LedgerChartOfAccounts, RecId));//MainAccount.LedgerChartOfAccounts == LedgerChartOfAccounts.RecId
query.dataSourceTable(tableNum(MainAccount)).addSelectionField(fieldNum(MainAccount, MainAccountId));
query.dataSourceTable(tableNum(MainAccount)).addSelectionField(fieldNum(MainAccount, Name));
//sysTableLookup.parmQuery(query);
grid.parmQuery(query);
grid.run();
//sysTableLookup.performFormLookup();
}
}public void build()
{
Dialog dialogLoc = this.dialog();
contract = this.dataContractObject() as IntercompanyReportContract ;
this.addDialogField(methodStr(IntercompanyReportContract , parmAccountNumList), contract);
this.addDialogField(methodStr(IntercompanyReportContract , parmFromDate), contract);
this.addDialogField(methodStr(IntercompanyReportContract , parmToDate), contract);
// contract = this.dataContractObject();
}
public void postBuild()
{
//super();
mainAccountLoc = this.bindInfo().getDialogField(this.dataContractObject(),
methodStr(IntercompanyReportContract ,parmAccountNumList));
mainAccountLoc.registerOverrideMethod(methodStr(FormStringControl,lookup),methodStr(IntercompanyReportUIBuilder , accountNumLookup),this);
if (mainAccountLoc)
{
mainAccountLoc.lookupButton(2);
}
}
contract class
[DataMemberAttribute("AccountNumList"),
AifCollectionTypeAttribute("AccountNumList", Types::String),
SysOperationLabelAttribute(literalStr('Account number'))]
public List parmAccountNumList(List _accountNumList = accountNumList)
{
accountNumList = _accountNumList;
return accountNumList;
}
dpclass
[SysEntryPointAttribute]
in dp class use the list in process method as
public void processReport()
{
GeneralJournalAccountEntry GeneralJournalAccountEntry1;
MainAccount main;
date periodStartDate;
str mainId;
ListIterator accountNumListIt;
container con;
contract = this.parmDataContract() as IntercompanyReportContract ;
fromDate = contract.parmFromDate();
toDate = contract.parmToDate();
//mainacc.MainAccountId = contract.parmAccountNum();
accountNumListIt = new ListIterator(contract.parmAccountNumList());
while (accountNumListIt.more())
{
mainacc.MainAccountId = accountNumListIt.value();
..
.. your code
//
intercompanyReportTemp.insert();
accountNumListIt.next(); }
No comments:
Post a Comment