Function toDecimal()
converts a number or a nubmer string into decimal and returns this decimal value, takes the scale from the original number if no specified. It returns UUID if NDOE or EDGE is passed in, or returns null
for the rest of cases.
Arguments:
- Value <number | string | text | bool>
- Scale <number>, 0~30, optional
Returns:
- Decimal <decimal>
Comman Usage
Example: Convert 123.456 to decimal and return, keep 2-digit scale
return toDecimal(123.456, 2)
123.46
Example: Convert '123.456abc' to integer, float and decimal
return table(toInteger("123.456abc"),toFloat("123.456abc"),toDecimal("123.456abc"))
| toInteger("123.456abc") | toFloat("123.456abc") | toDecimal("123.456abc") |
|-------------------------|-----------------------|-------------------------|
| 123 | 123.456 | null |