Hello, I have an unbound control named ElementType
The original control have 7 values inside but i have created a new dialog and on this dialog, according the selected record I fill the enum with different values everytime.
public void init() { ElementTable selectedRecord = this.args().record(); Set enumSet = new Set(Types::Enum); switch (selectedRecord.ElementType) { case ElementType::Object: case ElementType::Milestone: enumSet.add(ElementType::Task); enumSet.add(ElementType::Milestone); break; case ElementType::Task: enumSet.add(ElementType::Task); enumSet.add(ElementType::Milestone); enumSet.add(ElementType::Line); break; default: break; } sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(ElementTypeSelectionDialog,ElementType)),enumNum(ElementType),enumSet, "@Test:ElementType"); super(); }
Hello Girish
Exactly that was the solution:
str enumName = ElementType.valueStr(); SysDictEnum dictEnum = new SysDictEnum(enumNum(ElementType)); ElementType elementTypelocal = dictEnum.symbol2Value(enumName);
Please refer to the below article which uses SysDictEnum class to get the value.
https://axnews.blogspot.com/2020/08/convert-enumname-to-label-in-ax2012.html
Similary you can use SysDictEnum.valueToName() method to get the Enum element name.
Thanks,
Girish S.
Hello Girish
Yes of course. It was the first thing that I tried.
It seems that returns the correct value but it returns the label.
So that is not a solution. :(
Hi Christos,
Have you tried using the valueStr method of FormComboBoxControl - It will return the string value of that control. Try using that and let us know the outcome.
Thanks,
Girish S.
Martin Dráb
501
Most Valuable Professional
Saalim Ansari
313
Abhilash Warrier
310