You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I want to create a numeric field that is a Field value expression of another, text field.
Currently no easy way exists to convert text values to number when referencing one field to another in Module definition. There should be a Expression Function added to support doing it "inline".
There is a workaround of doing it via the workflow, but then it gets complicated.
Expected Behavior
No response
Steps To Reproduce
No response
Environment and versions
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
I see now that float is not in docs, but its the same for that float(textField)
So for a text field with value 12.3 it would be cast to a number with value 12.3
int(value) doesn't work for decimals, it returns 0 when there is a comma in the original text;
seems like float() works, it would be good to add it to the docs
I tried without casting and it works aswell.
So if i try to save "12.4" in a text field and just use the expression textField it casts it to float automatically
You might have been trying to use the "12,4" format
Apparently it does indeed work even without the casting function, but there is a catch:
At least on my system, the decimal numbers are displayed in Corteza as 123,45 - with a comma (it may be regional setting thing?)
However, casting from text to decimal works only if text is in the form of 123.45 - with a dot
Of course it's a quick fix, for example using replace(value, ",", ".", -1) in text field sanitation, it's just confusing from the user perspective.
Fajfa
changed the title
Add Expression Function converting string to number
Fix '12,3' cannot be casted to float
Apr 2, 2024
Fajfa
changed the title
Fix '12,3' cannot be casted to float
Fix '12,3' cannot be casted to float in field expressions
Apr 2, 2024
Is there an existing issue for this?
Version of Corteza
2023.9.4
Current Behavior
Say I want to create a numeric field that is a Field value expression of another, text field.
Currently no easy way exists to convert text values to number when referencing one field to another in Module definition. There should be a Expression Function added to support doing it "inline".
There is a workaround of doing it via the workflow, but then it gets complicated.
Expected Behavior
No response
Steps To Reproduce
No response
Environment and versions
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: