Skip to content

Init List

Summary

  • Internal name: InitList
  • Category: Collections
  • Purpose: Initialize a workflow variable to an empty list ([]).
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0

  • Maximum AndroMate version: 1.1.0

  • Minimum Android: Android 13 (API 33)

  • Maximum Android tested: Android 16 (API 36)

  • Supported manufacturers:

    • ✅ All manufacturers
  • Required permissions:

    • None

Detailed description

The Init List task resets a workflow variable to an empty ArrayList<String>, stored as [] in the execution context.

The variable must be declared in the Start node's variables list before using InitList. The task does not create a new variable — it resets the value of an existing one.

This is typically the first step in a Collections workflow: declare the variable in Start, call InitList to clear it, then use ListAdd, ListGet, etc.


Input parameters

Parameter Type Required Possible values Android Compatibility AndroMate Compatibility Default
list_variable_input Variable reference Yes Declared variable starting with $ Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0

Output parameters

None. The variable referenced by list_variable_input is set to [] in the execution context.


Exceptions

Code Exception Name Description
COLLECTION-TASK-002 List Variable Name Invalid list_variable_input is empty or does not start with $. A valid variable reference is required.
WORKFLOW-RUNTIME-002 Variable Not Defined in Runtime The variable was not declared in the Start node. Declare it first.

Execution flowchart

flowchart TD
    Start([Start InitList]) --> ReadInput[📋 Read list_variable_input\nno resolution applied]
    ReadInput --> CheckEmpty{Empty or\nnot a variable ref?}
    CheckEmpty -->|Yes| E1[❌ COLLECTION-TASK-002]
    CheckEmpty -->|No| CheckDeclared{Variable declared\nin Start?}
    CheckDeclared -->|No| E2[❌ WORKFLOW-RUNTIME-002]
    CheckDeclared -->|Yes| Store["💾 setVariableValue\nvar ← []"]
    Store --> Success([✅ VoidResult])
    E1 --> Error([❌ Exception])
    E2 --> Error

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Error fill:#ffcdd2
    style Store fill:#c8e6c9
    style E1 fill:#ffcdd2
    style E2 fill:#ffcdd2

How it works:

  1. Read list_variable_input: Loads the variable name as a literal string — no resolution applied
  2. Validation: Raises COLLECTION-TASK-002 if empty or not a $-prefixed reference
  3. Declaration check: Raises WORKFLOW-RUNTIME-002 if the variable was not declared in Start
  4. Store: Writes an empty ArrayList<String> serialized as [] into the execution context
  5. Result: Returns VoidResult

Input parameter details

1. Input parameter: list_variable_input

The name of the list variable to initialize. Must be declared in the Start node.

Example

"list_variable_input": "$myList"

Details

  • Must start with $.
  • The value is read as-is — no variable resolution is applied to this field.
  • The variable must have been declared in the variables array of the Start node.

Complete JSON example

{
  "Start": [{ "id": "0", "title": "Start", "variables": [
    { "variableName": "$myList", "variableValue": "" }
  ]}],

  "InitList": [
    { "id": "1", "title": "Init List", "list_variable_input": "$myList" }
  ],

  "End": [{ "id": "99", "title": "End" }],

  "Links": [
    { "from": "0", "to": "1" },
    { "from": "1", "to": "99" }
  ]
}