10

Ok, I think we've all been there: you have an enum that's shown to the user, and you need to add a new option. But, because of how enums work, if you use sequential IDs, and add a new option, it will always appear at the end, regardless of the logical relation between the different options.


What I'm proposing is to have a new SortBy property in enums, that specifies how Enums should be shown to the user (in dropdowns, when selecting a value). This property would have three possible values: Index (default), SortIndex, Caption.


This way, if nothing is specified, everything will work as usual. But, if we specify


enum 50000 "My Example Enum"
{
SortBy = Caption;
value(0; OptionB)
{
Caption = 'B';
}
value(1; OptionA)
{
Caption = 'A';
}
}

This would mean that the user would see a dropdown with the options "A" and "B" (actually depending on the user language and translated captions).


Similarly, if we specify SortBy = SortIndex

enum 50000 "My Example Enum"
{
SortBy = SortIndex;
value(0; OptionB)
{
Caption = 'B';
SortIndex = 1; // Required property if SortBy = SortIndex.
}
value(1; OptionA)
{
Caption = 'A';
SortIndex = 0;
}
}

The user would see "A" and "B" as options (in that order), regardless of their captions.

Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team

Comments

S

Would be also really useful for Enum Extensions!

Category: Development