Assign value to constant

Hi there,

I have created an inventory app for a carpenter to record the lengths of their woods. I have created two fields, one for the user to input the lengths in cm and the other to sums the values.

Since majority of the lengths are 300 cm I want to also allow the user to type 3L instead of 300. Therefore, I need to give the letter "L" the value of 100 and code the Total Quantity (cm) field to perform 3*100 when eg 3L is in the input. However, since I am new to coding, I don't know how to do this. Could you please help me include this code in my formula section within my sum function below?

User input
Field Name: Quantity (cm)]
Type: LongText (since user want each value entry to be on the next line)
Formula: none

Calculation field 
Field Name: Total Quantity (cm)
Type: Decimal
Formula: SUM(EXTRACTNUMBERS([Quantity (cm)]))

0 2 51
2 REPLIES 2

Hello @FPFDesigns1, you could make a list of all the common lengths used in that field and add those as "Suggested values" so the user doesn't have to write anything at all, just choose the length from a dropdown, and if the length he needs isn't in the list, he could just type it in.

If not, you could use this expression:

NUMBER(LEFT([Quantity (cm)],LEN([Quantity (cm)])-1))*100


It extracts a whole number and multiplies it by 100

Thank you so much Rafael for your suggestion and code. While you code is excellent, it does not cover my requirements. A sample of the user input is the following:

Quantity (cm)   <- user input
100
300
300
10

Total Quantity (cm)  <- automatically calculated output
710
_____

What I aim to do is to allow the user to write the below and also get the same calculated output as above.

 Quantity (cm)   <- user input
100
2L
10

therefore, the code has to first understand the following;

L=300
if L is after a value, multiply 300 with that value
Then Sum the total values.

Could you or anyone else please kindly help me to achieve this?

Top Labels in this Space