Hi, I have attribute Value and I need to convert this Value attribute into difference Units based on unit selection. By default, Value=2 and Original Unit=PSI1 as shown in below image Now, When I select Unit=PSI2 then my converted value should be Value=2 (PSI2 means original i. e. Value*2) as shown in below image : Now, When I select Unit=PSI3 then my converted value should be Value=6 (PSI2 means Original value i.e Value*3) But I got wrong output means it consider previous converted value not my original entered value i. e. 2 as shown in below image : At the end when I select Unit=PSI1 then Value should be set to original value i. e. Value=2, but I think I missed something in my microflow. For me it consider Value attribute with new updated value. How should improve my microflow to get correct conversion values? regards, Samarth Jadhav
You should either store the original value (without unit conversion) and use this in the conversion calculation OR you can take the value and first undo the last conversion (calculate the original value) and then do the new calculation with the original value and selected unit conversion.
It is probably easier to always store the original value (base value, without any conversions) and update this accordingly (for example when a new value is entered)
You can achieve this functionality by means of on change microflow of the Units dropdown widget.
Like, In the microflow,
You can create an integer variable with the value of 2.
Then you can keep a exclusive split with the units attribute. So that flow will split in to four directions like PSI1, PSI2, PSI3 and empty.
In each flow, based on units you can set value for that value field.
For example, If the user selects PSI1 in the dropdown, then in that PSI1 flow, you can set the value for that value field to 2 then similarly ways you can set the value for remaining units too.
If user selects PSI2, then the microflow executes and it will move in the direction of PSI2 there you can multiple the Initial Create variable value ( I.e) 2 with 2 and change the value field to 2 , So that it will display 4 in value field. Like wise for PSI3 too