Notifications
Announcements
No record found.
Hi All,
I have an enum field. It has three values in it. Is it possible to limit it to 2 values on run time .
Please provide some code.
Thanks & Regards ,
Nishath Salman
*This post is locked for comments
Yes, that's possible by overriding enter() method.
have a look at next URL from stackoverflow
stackoverflow.com/.../hiding-enum-elements-on-runtime-ax-2012
Also consider using an two enums and an edit method, as I suggested in your previous thread.
Hi thanks For your Reply.
But what I want is My Enum Field is holding an empty element ( I have not assigned the label for the element ). So when I open the table and click the enum field combo box it is showing the blankspace and then YES THEN NO. But I want it to show just YES and NO.
However the empty field should also be there but When I click the Combo it should show only YES/NO.
Please provide me some code. And enter() I cant use as I am not using any Combo Box Exclusively
That's not how enums work. If you want to be able to display {empty}, No and Yes, you're clearly talking about three distinct values, not just two. What's the problem with displaying all of them in the combobox? Also, why do you actively want to prevent users from returning to the original state after changing the value?
If you want to ensure that no record will be saved with the empty value, use an enum with three valuesand set the field as mandatory. It means that {empty} will be a valid value of the element, but it won't be allowed to be saved in database.
You can achieve exactly what you want by setting an invalid value of the enum, but it's not a good design. You should rather change your requirement.
Hi ,
Please let me know how to hide first entry in a table for an enum field
Does it mean that you don't want to use either of the two solutions above (despite the fact that you've verified them as answers)? Why not? What's requirement you have that it can't be implemented by these solutions?
I have Used them and all the solutions are working fine.
I just want to know is it possible to hide first entry of the field using (initValue) override method by table level.
In forms we can use HideFirstEntry option to do the same , however in table level how can I do so by making use of ( initValue ) override method. Please provide me some sample .
Bottom Line is I just want to Hide First entry in table level . Is it possible ?.
Use Unbound drop down and load values in dropdown at init method of form. There you can skip enum value like this.delete(enum2str(EnumType::Element1));
Trying to manipulate form controls at table label makes no sense. But you could use an edit method on table. (I suggested it to you so many times that I'm getting tired of it. Did you even try it? If so, what's the problem with it?)
initValue() is used for initializing field values (as I showed you in your previous thread); it's a completely different thing.
Hi thanks for your reply. But Please Understand my question. I want to do this Table level override method .
Can I Use initValue override method of the table to accomplish the task ..
Please provide me sample code.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2