Widgets/Transformer
Array Item Widget
Array Item Widget
A "Transformer" type widget. Array Item Widget extracts a single item from an array or string at a specified index position. It supports negative indices to count from the end, automatically detects the output data type, and indicates when no item is found. It's particularly useful for accessing specific elements in sequences or processing data item by item.
Inputs
- in (DataType: Array, String, Anything) The array or string from which to extract an item. When using type Anything, the widget will work if the value is either an array or string.
Outputs
-
output (DataType: Automatically determined) The item found at the specified index. The data type is automatically determined based on the extracted item:
- For strings: outputs a single character as String
- For arrays: outputs the item with its original type (Number, String, Object, etc.)
-
noItem (DataType: Boolean) Outputs
truewhen no item is found at the specified index (index out of bounds). Otherwise outputsfalse.
Custom Settings
- index (DataType: Number) The position of the item to extract (0-based index). Negative indices count from the end (-1 is the last item).

Examples
Working with Arrays
This example shows how to extract items from an array
Drag the example onto the workspace to explore and experiment!
In this example
- The Text widget provides the array as a JSON-formatted string, and the Text to Object widget parses it
- The Array Item widget is set to index
1(second element, since indexing starts at0) - The Array Item widget:
- Locates the item at index
1("banana") - Detects that it's a
stringvalue - Outputs
"banana"through the "output" port - Outputs
falsethrough the "noItem" port (item was found)
- Locates the item at index
- If the array changes but maintains the same length:
- The Array Item widget will output the new item at index
1 - The data type of the output adjusts automatically
- The Array Item widget will output the new item at index
Working with Strings
This example demonstrates extracting characters from a string
Drag the example onto the workspace to explore and experiment!
In this example
- The Text widget provides the string
"Hello"through the "in" port - The index is set to
-1(last position) - The Array Item widget:
- Converts
-1to the actual position (length - 1 = 4) - Extracts the character at that position (
"o") - Outputs
"o"through the "output" port
- Converts
- Using negative indices with strings works the same as with arrays:
-1gets the last character-2would get"l"(second to last)-5would get"H"(first character)
Handling Invalid Indices
This example shows what happens with an out-of-bounds index:
Drag the example onto the workspace to explore and experiment!
In this example
- The Text widget provides an array with
3numbers as a JSON-formatted string, and the Text to Object widget parses it - The parsed array is received through the "in" port of the Array Item widget
- The index is set to
5, but the array indices only range from0to2 - The Array Item widget detects the invalid index and:
- Does not transmit any value through the "output" port.
- Transmits
truethrough the "noItem" port.
- This same behavior occurs when:
- The index is negative and beyond the array start (e.g.,
-4for a 3-item array). - The index is larger than
array length – 1. - The input is a string and the index is outside its length.
- The index is negative and beyond the array start (e.g.,
📌 Additional Notes
- Index is 0-based (first item is at index 0)
- Negative indices count from the end (-1 is last item, -2 is second to last, etc.)
- The widget automatically detects the type of the extracted item
- When the index is out of bounds:
- The
outputport doesn't transmit a value - The
noItemport transmitstrue
- The
- Works with any array type (numbers, strings, objects, mixed types)
- For strings, each character is treated as an item
Glossary
-
0-based index
An indexing system where the first element is at position 0, the second at position 1, and so on. This is the standard indexing method used by most programming languages and the Array Item Widget.
-
Negative indices
Index values that count backwards from the end of an array or string. For example, -1 refers to the last item, -2 to the second-to-last item, etc.
-
Out of bounds
A condition that occurs when an index value is outside the valid range of an array or string. This happens when the index is negative beyond the start or exceeds the length minus one.