Hi All,
I have created a dialog form wherein I have added a field Store number which shows a list of stores.I have made it multiselected so that whatever values I mark in the drop down shows up in the field and also it get saved in a table.
The problem I am facing is that whatever value I select appears in the field even after closing the form but the 'Check 'on check boxes get disappear and the below image shows how it looks when we re-open the form.
Here the check mark on the Annapol and Atlanta values has gone.
Please help how can I retain these check marks with the values if the form is reopened.I have followed lot of blogs but unable to achieve this.
Please help!!!
Thanks in advance.
Hello Everyone,
Does anyone fixed the similar case in D365FO ? I have the same case, In Ax 2012 fixing the standard class SysLookupMultiSelectGrid worked but in D365FO , fixing is not possible.
Any help or suggestion is highly appreciated.
Thanks,
Rama krishna Tanneeru
Hi Somesh,
If you want to restore checkboxes in lookup based on prev. selected values, you can try to modify call for SysLookupMultiSelectCtrl::constructWithQuery.
multiSelectCtrl = SysLookupMultiSelectCtrl::constructWithQuery(formRun, formStringControl, query, false, [tableNum(RetailStoreTable), fieldName2id(tableNum(RetailStoreTable), fieldStr(RetailStoreTable, StoreNumber))]);
Hi,
next time when you share code, could you please click "Use rich text formatting - Insert - Code" so that it's easier to read. Thanks!
About your code, you also need to change the pack/unpack methods to save/fetch the CurrentList, but at least in your previous code the pack method was missing completely. Also, please delete your usage data regarding this object and see if it helps (after fixing the code).
Hi Nikolaos,
I have already done that but no luck.
Please help!!!
class enableCountingSetup extends RunBase
{
DialogRunbase dialog;
DialogField dfStoreNum;
DialogGroup dgStoreNum;
Query query;
QueryRun queryRun;
QueryBuildDataSource qbdsRetailStore, qbdsRetailChannel, qbdsOMOperating;
FormStringControl formStringControl;
FormBuildStringControl formBuildStringControl;
FormBuildControl formBuildControl;
SysLookupMultiSelectCtrl multiSelectCtrl;
FormRun formRun;
MandateCountingTable mandateCountingTable, mandateCountingTableDel, mandCountingTable;
RetailStoreTable retailStoreTable;
RecId storeRecIds;
container storeIds;
RetailStoreId storeNum;
container selectedStore, storeNumCon;
#define.CurrentVersion(1)
#localMacro.CurrentList
storeNumCon
#endmacro
}
Thanks
You should add the storeNumCon variable in [tag:CurrentList] in class declaration (see Tutorial_RunBaseBatch for example how to do it), and then pack/unpack it in pack/unpack methods.
Hi Nikolaos,
Below is the code snippet.
class enableCountingSetup extends RunBase
***************************************************
public static enableCountingSetup construct()
{
return new enableCountingSetup ();
}
****************************************************
public static void main(Args _args)
{
enableCountingSetup countingSetup = enableCountingSetup ();
if (countingSetup.prompt())
{
countingSetup.run();
}
}
****************************************************
public boolean unpack(container packedClass)
{
Version version = RunBase::getVersion(packedClass);
switch (version)
{
case #CurrentVersion:
[version, #CurrentList] = packedClass;
break;
default:
return false;
}
return true;
}
****************************************************
protected Object dialog()
{
dialog = super();
dialog.alwaysOnTop(true);
dialog.windowType(FormWindowType::ListPage);
dialog.allowUpdateOnSelectCtrl(true);
dgStoreNum = dialog.addGroup();
formBuildControl = dialog.formBuildDesign().control(dgStoreNum.name());
formBuildStringControl = formBuildControl.addControl(FormControlType::String, identifierStr(RetailStoreId));
formBuildStringControl.label('Store number');
return dialog;
}
****************************************************
client server static ClassDescription description()
{
return 'Manadatory counting setup at store';
}
****************************************************
public void dialogPostRun(DialogRunbase _dialog)
{
;
query = new Query();
qbdsRetailStore = query.addDataSource(tableNum(RetailStoreTable));
qbdsRetailStore.addSelectionField(fieldNum(RetailStoreTable, StoreNumber));
super(_dialog);
formRun = _dialog.dialogForm().formRun();
if (formRun)
{
formStringControl = formRun.design().control(formBuildStringControl.id());
multiSelectCtrl = SysLookupMultiSelectCtrl::constructWithQuery(formRun, formStringControl, query);
multiSelectCtrl.set([this.storeRecIdsToIDs(storeNumCon), storeNumCon]);
}
}
****************************************************
public container storeRecIdsToIDs(container _storeRecIds)
{
int i;
storeIds = conNull();
for (i = 1; i <= conLen(_storeRecIds); i++)
{
storeRecIds = conPeek(_storeRecIds, i);
if (storeRecIds)
{
select firstOnly StoreNumber from retailStoreTable
order by retailStoreTable.StoreNumber asc
where retailStoreTable.RecId == storeRecIds;
storeIds += [retailStoreTable.StoreNumber];
}
}
return storeIds;
}
****************************************************
public boolean getfromdialog()
{
boolean ret;
ret = super();
storeNumCon = this.storeRecIdsToIDs(multiSelectCtrl.get());
return ret;
}
****************************************************
public void run()
{
this.setup();
}
****************************************************
public void setup()
{
int i;
;
delete_from mandateCountingTableDel;
for (i = 1; i <= conLen(storeNumCon); i++)
{
storeNum = conPeek(storeNumCon, i);
if (storeNum)
{
select firstOnly mandateCountingTable
order by mandateCountingTable.StoreNumber asc
where mandateCountingTable.StoreNumber == storeNum;
if (!mandateCountingTable)
{
mandateCountingTable.StoreNumber = storeNum;
mandateCountingTable.insert();
}
}
}
}
Thanks in advance!!!
Can you share your code?
Hi Nikolaos,
I am using runbase framework for this.Can you please help that how can I save the check marks.
Thanks alot.
Hi Sergei,
Yes, I am using SysLookupMultiSelect class in runbase.
Thanks
Hi Somesh,
You need to place the value you selected in the container.
You can refer this thread:
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