divide by field

This block is part of the array group and was last modified in core v13.0.8.

divide by field v13.0.8

Returns an array with each item divided for the provided key

In pins 5
  • Array required
    array

    The array to be divided

  • divide key required
    value

    A key within each object in the array to be divided

  • divide by key required
    value

    A key within each object in the array to divide by • Hidden when other fields are filled

  • new field key
    value

    The key to set the new divided field on, if empty it will be set on the multiple key

  • divide by required
    number

    The amount this key should be divided by • Hidden when other fields are filled

Out pins 1
  • output
    array

    All items with or without divided values

For each object item, divides the divide_key field by the item's own divide_other_key field when that pin is set, otherwise by the divide_by number, writing the result to new_field_key when given, otherwise overwriting divide_key. Items that are not objects or whose divide_key is not numeric pass through UNCHANGED; division yielding infinity or NaN writes null. On missing configuration the block emits MISSING_DIVIDE_KEY or MISSING_DIVIDE_BY on error and no output array.

A typical wiring for divide by field: with values feeds the divide_array pin; value feeds the divide_key pin; value feeds the divide_other_key pin; number feeds the divide_by pin; the output_array out pin feeds length.

Studio canvas example for the divide by field block: typical wiring for divide by field.

Version history

Introduced in v13.0.8.


Back to array Return to the main group to view all sub-groups Back to array Return to the group to view all blocks within this group