Widgets/Transformer

Multiplication Widget

Multiplication Widget

A "Transformer" type widget. Multiplication Widget multiplies numbers, arrays, or properties of objects in arrays by a configurable factor. This is essential for scaling values, unit conversions, or combining sensor readings in your workflow.

 

How It Works

The widget outputs the product of its input value and the configured factor: output = input * factor


Inputs

  • in (DataType: Number, Array) The value(s) to multiply. Can be a single number, an array of numbers, or an array of objects with numeric properties.
    • If the input is a number, it is multiplied by the factor.
    • If the input is an array of numbers, each element is multiplied by the factor.
    • If the input is an array of objects, you can specify which properties to multiply.

Outputs

  • output (DataType: Number, Array) The result after multiplication. Matches the input type (number, array, or array of objects).

Custom Settings

This widget offers settings to customize its behaviour:

  • Factor: The number to multiply by (default: 2).
  • Decimal Points: Number of decimal places to round the result to (default: 2).
  • Properties to Multiply: (for arrays of objects) Specify which properties to multiply. If left empty, all numeric properties are multiplied.

Custom Settings

 

📌 Important Notes

  • Inputs must be numbers, arrays of numbers, or arrays of objects with numeric properties; non-numeric values are ignored.
  • If the input or factor is missing or invalid, the output will not be produced.

 

Examples

Basic Multiplication

Multiply the value of a Slider Widget by a factor set in the Multiplication Widget settings:


Drag the example onto the workspace to explore and experiment!



In this example:

  1. The Slider widget is set to output values from 0 to 10
  2. The Multiplication widget multiplies this value by the factor of 2
  3. The result is sent to a Display widget

 

Multiply Array of Numbers

Multiply each value in an array by the factor:


Drag the example onto the workspace to explore and experiment!



In this example:

  1. An array of numbers [ 1, 2, 3 ] is provided as input
  2. The Multiplication widget multiplies each element by the factor 3
  3. The result for each item in the array can be seen in the Port Inspector tool by clicking on the Multiplication widget's "output" port

 

Multiply Properties of Objects in an Array

Multiply specific properties in an array of objects:


Drag the example onto the workspace to explore and experiment!



In this example:

  1. An array of objects [{ "a": 1, "b": 2 }, { "a": 3, "b": 4 }] with numeric property values is provided as input
  2. The Multiplication widget "Properties" is set to "a" and a multiplication factor of 5
  3. The Multiplication widget multiplies only the "a" property of each object in the array by the factor of 5
  4. The result for each "a" property in the array can be seen in the Port Inspector tool by clicking on the Multiplication widget's "output" port

 

📌 Additional Notes

  • The Multiplication Widget is ideal for scaling, unit conversion, and combining values.
  • Use the "Properties" setting to target specific fields in arrays of objects.
  • This widget is designed for data manipulation in workflows.

 

Glossary

  • Port Inspector

    The Port Inspector is a panel in Kemu’s Logic Mapper that shows details about a selected port.
    It can be enabled or disabled from the settings menu (gear icon).
    When visible, clicking a port will load its information, including:

    • Data Type (e.g., Object, Array)
    • Port Type (Source or Target)
    • Last Value (latest transmitted data)

    This helps you inspect values, review port behavior, and debug connections.

  • Workflow

    A Kemu-specific connected sequence of Widgets that processes data step by step.