Hi experts,on modified method of Category lookup,written below code to get second lookup multi select.
on clicking store number lookup either first time when form opens up or after changing category lookup value,this error comes,i dont know why is this coming and what does it mean?Some guide me.
*This post is locked for comments
Hi Faran,
Probably the next blog will help you with the multi-select lookup: community.dynamics.com/.../using-multi-select-lookup-control-in-microsoft-dynamics-ax-2012
Hi André Arnaud de Calavon,
Issue is that on lookup method of store number,code works for single select only.
Hi Faran,
My initial thought is that the coding for the multi select should not be used on the modify of the category control. This is typically coding that belongs on a lookup method of the store number.
Hi André Arnaud de Calavon,
I tell u step by step.I am working on a custom form,like below,i want store number lookup multi select like in screen shot attached below and values in store number lookup drop down should come based on first lookup enum value(Concept lookup) at run time.
Here i share details with you,i have added two controls for parameter,not from form datasource but by setting enum value and edt.
Screen Shot
1- 2-
3- 4- 5-
///Class Declaration final class FormRun extends ObjectRun { SysLookupMultiSelectCtrl msctrl1; boolean viewInventTrans; str fromdate; int64 recordscount; RealBase locinvoiceCount; ListEnumerator listEnumStore; List listStores; RetailTransactionSalesTrans salestrans; InventDimCtrl_Frm_mov inventDimFormSetup; InventTransReference inventTransReference; int transactionView; NoYes linkView; #define.CurrentVersion(1) #localmacro.CurrentList transactionView #endmacro } //Form's Close public void close() { super(); } /// Form's init void init() { super(); viewInventTrans = false; tabSalesLine.visible(true); } ///cfzMask:modified (category Lookup modified) public boolean modified() { boolean ret; QueryBuildDataSource qbds1,qbds2; QueryBuildRange qrStore; QueryRun qr; Query query = new Query(); qbds1 = query.addDataSource(tableNum(RetailStoreTable)); qbds2=qbds1.addDataSource(tableNum(RetailTerminalTable)); qbds2.clearRange(fieldNum(RetailTerminalTable,CFZMask)); qbds2.addRange(fieldNum(RetailTerminalTable,CFZMask)).value(SysQuery::value(cfzMask.valueStr())); qbds2.joinMode(JoinMode::InnerJoin); qbds2.addLink(fieldNum(RetailTerminalTable,StoreRecId),fieldNum(RetailStoreTable,RecId)); qr = new QueryRun(query); if(msctrl1) { msctrl1.refreshQueryRun(qr); } else { msctrl1 = SysLookupMultiSelectCtrl::constructWithQueryRun(element,StoreID,qr); } ret = super(); return ret; } ///DateTo:modified public boolean modified() { boolean ret; ret = super(); return ret; } ///Search button:click void clicked() { CFZSalesKPIReportTmp cfzSalesKPIReportTmploc; RetailChannelTable retailChannelTable; RetailTransactionTable retailTransactionTable,rtstemp; OMOperatingUnit OmOperatingUnit; ; super(); if(str2Date(BackorderDate.valueStr(),213) > str2Date(DateTo.valueStr(),213)) { throw error("From Date cannot be greater than To Date"); } delete_from CFZSalesKPIReportTmp; //if(listStores && !listStores.empty()) //{ //listEnumStore = listStores.getEnumerator(); //while(listEnumStore.moveNext()) //{ //storeid = listEnumStore.current(); while select count(Recid),sum(grossAmount),sum(numberOfItems),sum(DiscAmount),channel,store from retailTransactionTable group by retailTransactionTable.store,retailTransactionTable.transDate,retailTransactionTable.Channel where retailTransactionTable.store == StoreID.valueStr() && retailTransactionTable.type == RetailTransactionType::Sales && retailTransactionTable.entryStatus != RetailEntryStatus::Voided && retailTransactionTable.transDate >= str2Date(BackorderDate.valueStr(),213) && retailTransactionTable.transDate <= str2Date(DateTo.valueStr(),213) { recordscount = retailTransactionTable.Recid; Select firstonly1 retailChannelTable where retailChannelTable.RecId == retailTransactionTable.channel; cfzSalesKPIReportTmploc.clear(); cfzSalesKPIReportTmploc.store = retailTransactionTable.store; cfzSalesKPIReportTmploc.Storename = DirPartyTable::findRec(retailChannelTable.OMOperatingUnitID).Name; cfzSalesKPIReportTmploc.transDate = retailTransactionTable.transDate; cfzSalesKPIReportTmploc.InvoiceCount = any2real(recordscount); locinvoiceCount = any2real(retailTransactionTable.RecId); if(retailTransactionTable.numberOfItems == 0) { cfzSalesKPIReportTmploc.UPT = 0; } else { cfzSalesKPIReportTmploc.UPT = (retailTransactionTable.RecId/retailTransactionTable.numberOfItems); } if(retailTransactionTable.grossAmount == 0) { cfzSalesKPIReportTmploc.ATV = 0; } else { cfzSalesKPIReportTmploc.ATV = (retailTransactionTable.RecId/retailTransactionTable.grossAmount); } if(retailTransactionTable.grossAmount == 0) { cfzSalesKPIReportTmploc.PerSquareFeetSales = 0; } else { cfzSalesKPIReportTmploc.PerSquareFeetSales =(retailChannelTable.StoreArea/retailTransactionTable.grossAmount); } retailTotalDiscAmount = retailTransactionTable.grossAmount; if(retailTotalDiscAmount<0) { retailTotalDiscAmount = retailTotalDiscAmount>0 ? -retailTotalDiscAmount:abs(retailTotalDiscAmount); cfzSalesKPIReportTmploc.GrossAmount = retailTotalDiscAmount; } else { cfzSalesKPIReportTmploc.GrossAmount = retailTotalDiscAmount; } cfzSalesKPIReportTmploc.TotalQty = retailTransactionTable.numberOfItems; cfzSalesKPIReportTmploc.StoreArea = retailChannelTable.StoreArea; retailDiscAmount = retailTransactionTable.discAmount; cfzSalesKPIReportTmploc.totalDiscAmount = retailDiscAmount; cfzSalesKPIReportTmploc.insert(); } CFZSalesKPIReportTmp_ds.research(); }
Hi Faran,
Can you explain what the variable 'msctrl1' is? Is the error caused by the 'if true' or 'if false' part of the lookup method? What do you mean with 'second lookup multi select'?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156