how can i add attribute having enumeration data type from same entity??

0
i have this entity and i want to add 3 attribute with emun data type. how???
asked
3 answers
0

Hi,

In the entity add attributes with data type as enumeration and select the created enumeration .

You can also follow:

https://docs.mendix.com/refguide/enumerations/

 

For summing of the enumeration in the microflow get values create a list for each enum and use aggregate list function for getting the total.

 

https://docs.mendix.com/refguide/aggregate-list/

 

if this solution helps please accept the answer.

Regards

 

 

answered
2

Hi Prasanna, 

The enumerations are actually predefined string values and if you will try to set the numbers are string it will store the numbers with a ‘_’ as a prefix for each number.

So, for getting the grades in integer format, either you can use the method that Chris suggested or, can pass the enum value in a microflow, and then you can create a string variable to change the ‘_2’ to 2 by using replaceall() function and the parse integer to change the ‘2 ’ into 2(int).

you can refer to the image below,

 

Now, you have got your numbers,

 

Just create an Integer variable and then you can sum up all the attributes together:

Put the value of the integer something like this,

for ex.

$Grade/Knowledge + $Grade/Relevant+ $Grade/Education

 

Let me know if you have any issues,

Hope it helps!!

answered
0

Enumerations are strings and you cannot add up strings. If you use Key values like _1, _2 you can use getKey, Substring and parseInteger to do this calculation.

 

Alternative is a microflow EnumXToValue with input Enum and output Integer. Use split and set the values in the end events.

 

call this for the 3 attributes and sum the results.

answered