Skip to main content
Roberty Studio
RPAFunctions

Convert to number

Convert to number

Converts a text value to the numeric type, with support for different ways of handling the decimal part. Ideal for situations where a value was captured as text — from a spreadsheet or a web page, for example — and needs to be used in calculations.


Options​

Value, text or variable​

Enter the text value that will be converted to a number. It can be a fixed text, a number, the return of another action, a variable or a parameter.

Fraction Separator​

Select the character that separates the integer part from the decimal part: Comma or Dot. For example, with Comma, the value "1.234,56" becomes 1234.56.

Number of Fractions​

Enter how many of the last digits of the value must be treated as decimal places. For example, with 2, the value "1234" becomes 12.34. This field is only considered when no Fraction Separator is selected.

Returns​

Javascript code​

js
actions["action-id"].number // value converted to a number (Number)

Field selection​

  • number — numeric value resulting from the conversion (Number)

Rules and Conditions​

  • The Value, text or variable field is required.
  • All characters that are not digits are discarded before the conversion — including the minus sign.
  • When the Fraction Separator is provided, it takes priority over the Number of Fractions.
  • Without Fraction Separator and without Number of Fractions, the result is an integer formed by all the digits of the value (for example, "12,34" becomes 1234).
  • If the value is already a number, it is returned unchanged.