Iterate through Enumuration

0
I have an Enum which is the 'status' of an Order entity. I'm looking to have a next/previous status which will move the status onto the next Enum value.  Is it possible in a Microflow to lookup the next or previous value in an Enum?
asked
4 answers
1

There is no "order" to an enumeration so there isn't a way to get the "next" value. You have to do a lookup and build your rules accordingly.

Another option to consider, though, is to setup the Statuses as data (in a table) instead of an Enumeration. Provide a Name and a SortID that is an Integer. You could then do a simple GetNext using the Integer value of the current +1, and allows you the freedom to reorder the statuses or add new ones in the future and still not have to recode in the modeler. You would have to consider all of the ramifications of this approach but in some cases it might be better than an enumeration.

answered
2

Nope, that is not possible. The easiest way is create a microflow called GetNextStatus. Input parameter would be the current status, output parameter would be next status. You could even add other data elements and use them to decide what the next status is.

 

If you model it out with exclusive splits it is very easy to see what the order of the statuses are. You could also create if statements but they are harder to read for business users.

answered
1

Hi Cliff,

 

Sorry that I can not give a better answer but only thing that comes to mind is hardcoding a lot of "if then" statements

e.g.

if $status = 'One' then $Status = 'Two'
else (if $status = 'two' then $Status = 'Three'
      else (if $status = 'three' then $Status = 'four'))

and so on...

Good luck,

Andrej

answered
0

Thanks all for the quick responses, I'm leaning towards the creating a table with a sequence option instead.

Does anyone believe having the ability to iterate through an Enum in a microflow would be a useful feature?

answered