Widgets/Transformer

Convert Value Widget

Convert Value Widget

A "Transformer" type widget. Convert Value Widget converts an input value to a different type: String, Integer, Decimal (with configurable decimal places), Rounded Integer, Absolute value, or ImageData. This is useful for preparing data for other widgets, formatting outputs, or ensuring type consistency in your workflow.

 

Inputs

  • in (DataType: Number, String, Anything, BinaryFile) The value to be converted. Accepts numbers, numeric strings, or any value that can be interpreted as a number or string. When ImageData conversion mode is selected, accepts a BinaryFile containing an image.

Outputs

  • out (DataType: Number, String, or ImageData) The converted value, with type depending on the selected conversion mode.

Custom Settings

  • Convert To — Select the target type for conversion:
    • Integer: Converts to an integer (e.g., 3.73)
    • Decimal: Converts to a decimal with specified places (e.g., 3.141593.14)
    • String: Converts to a string (e.g., 3.14"3.14")
    • Round: Rounds to the nearest integer (e.g., 3.64)
    • Abs: Converts to the absolute value (e.g., -55)
    • ImageData: Converts a BinaryFile image to ImageData. Only certain image formats are supported: PNG, JPEG, JPG, GIF, WebP, BMP, and SVG.
  • Decimal Places — (Only for Decimal mode) Number of decimal places to keep.

Custom Settings

 

📌 Important Notes

  • Only numeric values and numeric strings are converted. Arrays, objects, and other types are ignored
  • The output type depends on the selected conversion mode
  • For Decimal mode, the number of decimal places is configurable in the settings
  • For ImageData mode, the input must be a BinaryFile containing an image. Supported image formats are: PNG, JPEG, JPG, GIF, WebP, BMP, and SVG. Unsupported formats will result in an error

 

Example

Convert a Number to Integer

This example converts the value 3.14159 to an integer (3):


Drag the example onto the workspace to explore and experiment!


In this example:

  1. The Button widget triggers the Value widget to provide the input value (3.14159)
  2. The Value widget transmits the decimal value to the Convert Value widget
  3. The Convert Value widget converts the decimal value to an integer using the Integer mode
  4. The Display widget receives the converted integer value and shows the result