Hi Team,
Create ranks for enumeration such that you can apply logics based on rank.
e.g. if Status is created for Enums, we can put a condition if status is less than a particular rank - do certain activities like that.
Currently our app is having 13-14 statuses for one document and wherever we need to apply visibility conditions/exclusive checks all the applicable statuses need to write.
but we can change this with rank.
Thanks Pim, it was the solution we have used in one of the applications in the past.
I felt it could be included directly in the enum.
In addition to caption and value they can also have a rank in integer / this rank is based on the order of enum values
You can make use of EnumReflection part of my marketplace module Convent Commons.
I did make a quick test page and nanoflow. It works for all enumerations. When an enum value is added no code changes are needed. When a value is deleted code changes may be necessary. Maybe I will add enum ranking to a next version of EnumReflection.
I'd recommend one of the two following ways:
1) Use a helper object to calculate the rank once based on value and use this in your document
2) Create an entity, and for each Enum value, an object/instance of this entity and a rank. Associate this entity with your document / main object, and retrieve via association, you can then get the rank and use it for visibility