Value of an attribute should change depending on selected enumeration values
Hello, I have an attribute called 'points', and a few enumerations. These enumerations have multiple values (for example, an enumeration by the name of 'complexity' has the values 'simple', 'semicomplex', and 'complex'). Depending on this value, a certain amount of points should be added to the 'points' attribute; 'simple' should add one point, 'complex' three. For example: Enumeration1 has the possibilities A1, B1, and C1. User1 has B here. Enumeration2 has the possibilities A2, B2, and C2. User1 has C here. Enumeration3 has the possibilities A3, B3, and C3. User1 has C here. A is one point, B is two points, C is three points. User1 would have a total of 2+3+3=8 points. But, I have no idea at all how to achieve this. Nor can I find any tutorials on similar things - with one exception; I saw something about a survey ( https://forum.mendix.com/questions/5114/Microflow-setting-an-enumeration-value-to-an-attribute ) but I'm afraid I don't really understand that either. Thanks in advance! I realise this is probably a silly question that everyone knows the answer to, but, I'm having a hard time even getting my head around the basics of microflows. I understand how it works in theory, but in practice I keep running into obstacles.
Create an microflow and attach it to the onchange event of the 3 enum fields.
The first action is create a integer variable.
Second action is a split that uses the first enum field ($entity/enum1) as condition.
The split has 4 outcomes, A, B, C or empty.
Attach a change variable action to each outcome and change the first created variable to the appropriate value.
Add a merge action to merge the 4 outcomes.
On the second split use the second enum and in the actions make sure to set the variable to the variable value+the appropriate number.
Merge again and repeat for the third enum and merge again.
After this last merge add a change action to set the complexity field with the value of the variable created at the start of the microflow (make sure to save and refresh)
Hope this helps you in finding your solution.
Erwin 't Hoen
Certainly! It wasn't quite the answer I was looking for - all enumerations have different values, while you're assuming they're all the same I think - but I managed to get your explanation to work for one enumeration, duplicated it to work for the others too (one microflow for one enumeration), and then simply added up all the values with a button. It took me a bit more than an hour, but, I did it, so thanks a lot!