numeric and integer values

0
$workers/number_of_workers> 5  the number of workers is numeric and I can’t put condition with integer 5. How can I correct it.
asked
3 answers
2

Hi Asli,

If the number_of_workers attribute is an enumeration you will have to convert it to a compatible integer format for the comparison.

There are a couple of ways to do this depending on how your enumeration is set up:

The first way I would use if there are only a few values in your enumeration is to create a variable in your microflow using if statements to map the enum values e.g.
 

if $workers/number_of_workers = module.number_of_workers.One
then 1
else if $workers/number_of_workers = module.number_of_workers.Two
then 2
else if...

The above is most suitable if you have a small number of enum values to map and typically if you want to map your enum values to an unrelated value e.g.  If the enum value is ‘Twelve’ then you could map to 12

 

If you have many values in your enum a more suitable method is to use the getCaption() function, scrub any non integer values from the resulting string using string functions, and then convert to an int.  This works best if the enum values are just numeric values, if so something like the snippet below will work to convert them to an integer
 

parseInteger(getCaption($worker/number_of_workers))

 

Hope this helps,

Danny Kumpf

answered
0

Yes, sure

answered
0

number of workers is enumeration and I want to make a condition with that and an integer.

answered