Unit Conversion using dropdown list

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
2 answers

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)



Hi Samarth,

You can achieve this functionality by means of on change microflow of the Units dropdown widget.

Like, In the microflow,

  1. You can create an integer variable with the value of 2.
  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.
  3. In each flow, based on units you can set value for that value field.
  4. 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.
  5. 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