I have a formular to extract number from a string. After successfully extract the digits; I convert it to Number for calculation. However, the decimal value is not retained after converted.
Example: Number(“0.08”) => 0 (zero).
My app is using english locale.
Is there any way i can convert number-like text with decimals to number?
Based on understanding of your description, you wish to extract a decimal value from a text string and further use it for calculation.
If so please try the following expression in a decimal type column.
INDEX(EXTRACTNUMBERS([Text_Column]),1)
The above assumes that there is one decimal value in the [Text_Column] that you wish to extract and save it in a decimal type column for further calculation.
So, if the [Text_Column] contains a text string say , “The weight of the baggage is 75.35 kgs” , the result in the decimal column would be 75.35
Example below:
The text string is hardcoded in a decimal type VC.
You are welcome. I believe EXTRACT() functions have been around for 5 + years.
In general you could have also used DECIMAL(“0.0123”) instead of NUMBER(“0.0123”) to retain the decimal places. Wrapping with NUMBER() strips the number value of any decimal places and returns an integer value in AppSheet.
However , I believe you are working with text strings. So using EXTRACTNUMBERS() is a better option than other composite expressions to first extract number from the string and then converting it to a decimal value.