Skip to main content

Last In List

Uncontrolled node

Overview

The Last In List node extracts the final element from an array. It is useful when you need to access the most recent item in a sequence, the last row of data, or the final entry in a collection.

This node is uncontrolled, meaning it executes immediately whenever its input changes and does not require an event trigger to run.

Inputs

InputTypeDescriptionDefault
listDataThe list (array) from which to extract the last element.-

Outputs

OutputTypeDescription
outputDataThe last element of the input list. Returns null if the input is not a valid list or if the list is empty.

Runtime Behavior and Defaults

  • Null Safety: If the input is not an array or if the array has no elements, the node outputs null rather than throwing an error.
  • Immediate Execution: As an uncontrolled node, it processes the input instantly whenever the connected data changes.
  • No Side Effects: This node does not trigger events or modify workflow state beyond setting its output data.

Example Usage

Scenario: You have a workflow that collects multiple items into a list and you need to retrieve only the final item for further processing.

  1. Connect a node that outputs a list (such as a List node or the output from a Read CSV node) to the list input of the Last In List node.
  2. Connect the output of the Last In List node to any node that processes the item (such as an AI Write node or a Set Variable node).

Example: If the input list is ["apple", "banana", "cherry"], the output will be "cherry". If the input list is empty [], the output will be null.