Averaging numbers in enumeration attribute

0
Hello -  I have an attribute of type enumeration for "Grade", so the following values (2.3, 2.7, 3.0, 3.3, 3.7, 4.0). These values are stored in my "Evaluation" entity. For every Evaluation, a Grade is selected. I'm now building a microflow that is triggered after the commit of each Evaluation, which finds the average of Grade (for each student). How do I convert the Grade enumeration to a decimal now in order to find the average? I tried creating a new decimal field that is set to parseDecimal(getCaption($Evaluation/Grade)) . . . but this isn't working. Any ideas? Thanks, Mark
asked
2 answers
0

Hi Mark,

As Austin asked: why is the calculation after the commit? Shouldn't it be before the commit, so the newly calculated average grade also is correctly saved?

To answer the question on how to go from an Enum value to a Decimal value: in Mendix I like to make these kind of operations visible in my microflows, as it helps in maintainability and flow readability. In your case, you could do something like this:

If the above is not clear, I can share the microflow if you want!

answered
0

answered