Value based on conditions also save said value to database

Hello All, My app is a logistics pricing tool and it requires different conditions to calculate a value for the user. for example we are using the distance between two places to get the trip milage, but depanding on the distance, the per miles rate requires change. So with that we are using the Conditions when miles is > 100 * 1.25 along with some custom states to control other surcharges.

My issue with this method is we are forced to use the text element to run the conditions needed but with that I am unable to get the final value to store it in our database?

If any has a solution to this using the input elements or how to store the value to the database using the text element.

Instead of calculating the values in the text elements, calculate them on the groups that contain them. Then you can refer to those groups’ values in the text elements AND in your workflows to save them to your DB.

e.g. Set your ‘Regular Price’ group to have a content type of ‘number’, and the data source to be the same expression you’re currently using in your text box (without the ‘$’ or the ‘formatted as’ part).

Use the same conditionals on the group as you’re currently using on your text box, to change the group’s data source depending on the conditions.

Then in your ‘Text $PriceReg’ text box just refer to the parent group’s number (with a $ sign before it, and formatted to 2 decimal places etc.).

Then in your workflow you can also refer to that group’s number to save it in your DB wherever you need to.

I believe I figured it out :facepunch: I will give it a go and let you know once complete. Thank You

1 Like

This method worked great! Thank You for all your help :grinning:

1 Like