Here’s a solution to converting Text to Float (decimals)
Firstly, thanks to @Matt_Blais for his awesome solution to convert Text to Integer! From now on, I will call his function “MattFunction” because I will explain the solution for anyone interested.
In essence, the solution is:
InputText
→ Convert the integer part to Integer (Int_int) and convert the Decimal part to Integer (Dec_int) using the MattFunction
→ Convert Dec_int to float (Dec_dec) by diving it by a multiple of 10 → Dec_dec = (Dec_int/Power(10, Length(Dec_int))
→ Create the final float using Int_int + Dec_dec
Example
Input Text = 123.678
Int_int = 123
Dec_int = 678
Dec_dec = 678 / 10^3 = 0.678
Float = 123 + 0.678
- How do we get Int_int and Dec_int? → Using the Left, Right, Find, and Length Functions.
- Does it work with regular Integers and/or regular decimals? → Yes if we add some conditionals
Easiest way to replicate it is to use helper Formula Columns like in the screenshot above but if we wrap all of them in a single one we get the following monster formula. If you want to use it I guess you need to use a text editor to Find and Replace the “InputText” with the name of your target Column in Fibery.
If( MatchRegex(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)),"[^0-9]"), -9999,
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<1, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-0, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<2, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-1, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<3, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-2, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<4, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-3, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<5, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-4, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<6, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-5, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<7, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-6, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<8, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-7, 1)) - 1) + 10 *
If( Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))<9, 0, (Find("0123456789", Middle(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)), Length(Left(InputText, If(Find(InputText, ".") = 0, Length(InputText), Find(InputText, ".") - 1)))-8, 1)) - 1) + 10
))))))))))
+
If( MatchRegex(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))),"[^0-9]"), -9999,
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<1, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-0, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<2, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-1, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<3, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-2, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<4, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-3, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<5, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-4, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<6, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-5, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<7, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-6, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<8, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-7, 1)) - 1) + 10 *
If( Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))<9, 0, (Find("0123456789", Middle(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))), Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, "."))))-8, 1)) - 1) + 10
))))))))))
/
Power(10,Length(If(Find(InputText, ".") = 0, "0", Right(InputText, Length(InputText) - Find(InputText, ".")))))
Yes, the formula is unreadable, but it works with native Fibery Formulas. It is a good temporary solution until we get the “ToNumber” function or the ability to have custom functions or “Lambdas” or at least the “Lets” function.