List package guide
Use List actions to read, change, compare, and reorder typed items.
Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
Create the List variables first, with the stated String, Number or Boolean types. No other application, connection or session is needed. A String with JSON text cannot be used as a List or Table. For Table inputs, use a Table variable or a Table literal with the right columns and rows.
| You put in | You get back |
|---|---|
| String, Number, Boolean, List, Dictionary | The same type |
| Datetime | Text, such as 2024-03-15 |
| File, Any text | String |
| Record, Table, Credential, Window | Dictionary |
JSON null | String null |
Shared fields
To keep a change, save the output back in the same List variable. To keep the original, save it in a new variable. Save an Any output in Any or a type that fits the value.
List: use a List variable such as $items$, or a JSON list written directly in the step.
Any item: enter text, or select a typed variable such as $value$. Text written directly stays text. For a Number or Boolean, use a variable of that type.
Indexes: items are numbered from 0. The last item is the count minus 1. An empty List has no item index. To add at the end, use the count. Index and size fields use whole numbers, and cut off a fraction toward zero.
Text comparison: difference, common items, duplicates and sorting compare text, so Number 1 can equal String 1. Sorting is by character code, not by number or language. Choices ignore case. Fields for another mode are not used, but all fields that you fill must have valid types and formats. Omitted optional fields keep their defaults, as do blank optional typed fields (not text).
List inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
source | List variable | Listdefault []required | List. |
input | Select list | Listdefault []required | List. |
item | Index number | Numberdefault 0optional | Existing-item index. |
case | Case-sensitive comparison | Booleandefault falseoptional | false ignores case; true distinguishes it. |
Actions
Add item (listAddItem)
Add an item to a List.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
list | Item to be added | Anydefault ""optional | Any item. |
item | Add item | Itemdefault ENDoptional | Choose END to append or ANY to insert at position. |
position | positionNumber | Numberdefault 0optional | ANY only: insertion index 0 through count. |
Uses the shared inputs: sourceList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
source | List | The changed List. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$, listItem=c, itemPosition=ANY, positionNumber=0. Bind sourceList to $items$.
Expected result
$items$ becomes ["c","a","b"]. An insertion index outside 0..count fails.
Add item to a copy (listAddItemCopy)
Add an item to a copy. The original List does not change.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
input | Select list to copy from | Listdefault []required | List. |
item | Item to be added | Anydefault ""optional | Any item. |
insert | Add item at position | Insertdefault ENDoptional | END appends; INDEX inserts at item. |
item | Enter item position index | Numberdefault 0optional | INDEX only: insertion index 0 through count. |
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | New List with the added item. |
Example
Create $items$ with Strings a, b. Set inputList=$items$, item=z, insertType=INDEX, itemPosition=0. Bind result to $copy$.
Expected result
$copy$ is ["z","a","b"]; $items$ stays ["a","b"]. Invalid insertion indexes fail.
Assign (listAssign)
Copy a List, with its order and types, to another variable.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
source | Select the source list variable | Listdefault []required | List. |
Outputs
| Identifier | Type | Meaning |
|---|---|---|
destination | List | Assigned List. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$; bind destinationList to $copy$.
Expected result
$copy$ contains ["a","b"]. An empty input produces [].
Append (listAssignToDataTable)
Add the List to a Table as a new column, one item per row.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
source | Select list variable | Listdefault []required | List. |
to | Assign the outcome to data table | Tabledefault empty Tablerequired | Existing typed Table, including empty Table; JSON String is invalid. |
position | Insert column at index | Positiondefault lastoptional | first inserts before all columns; last appends; specific uses specific. |
specific | specificColumnNumber | Numberdefault 0optional | specific only: column insertion index 0 through column count. |
Outputs
| Identifier | Type | Meaning |
|---|---|---|
to | Table | New Table with the inserted column. |
Example
Create $items$ as List a, b. Create $grid$ as a Table with one String column A and rows x, y. Set sourceList=$items$, toTable=$grid$, positionSelected=lastPosition; bind toTable to $grid$.
Expected result
Columns are A, Column2; rows are ["x","a"], ["y","b"]. The new column is named Column plus its one-based position. Its type is the common item type, or String for mixed/empty lists. The row count is the larger input count; missing cells become empty Strings. Invalid column indexes fail.
Chunk list (listChunk)
Split a List into smaller Lists of a set size. The item order stays the same.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
chunk | Enter max size of sub lists | Numberdefault 1optional | Integer maximum greater than 0; final chunk can be shorter. |
Uses the shared inputs: inputList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | Typed List items. |
Example
Create $items$ with Strings a, b, c. Set inputList=$items$, chunkSize=2; bind result to $batches$.
Expected result
$batches$ is [["a","b"],["c"]]. Empty input gives []; zero or negative size fails.
Clear (listClear)
Remove all items from a List.
Inputs
Uses the shared inputs: sourceList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
source | List | Empty List. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$; bind sourceList to $items$.
Expected result
$items$ becomes []. An already empty list remains empty.
List difference (listDifference)
Get the items in the first List that are not in the second.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
first | Select first List | Listdefault []required | First List; its order controls the result. |
second | Select second List | Listdefault []required | Second comparison List. |
Uses the shared inputs: caseSensitive.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | The items not in the second List, with their order and repeated items kept. |
Example
Create $first$ with Strings a, B, c, and $second$ with b, d. Set firstList=$first$, secondList=$second$, caseSensitive=false; bind result to $difference$.
Expected result
$difference$ is ["a","c"]. With caseSensitive=true, it is ["a","B","c"]. No unmatched items gives [].
Find common items (listFindCommonItems)
Get the items in the first List that are also in the second.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
first | Select first list | Listdefault []required | First List; its order controls the result. |
second | Select second list | Listdefault []required | Second comparison List. |
Uses the shared inputs: caseSensitive.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | The items also in the second List, with their order and repeated items kept. |
Example
Create $first$ with a, B, c, and $second$ with b, d, all as text. Set firstList=$first$, secondList=$second$, caseSensitive=false; bind result to $common$.
Expected result
$common$ is ["B"]. With caseSensitive=true, it is [].
Get item (listGet)
Read an item by its number. It stays in the List.
Inputs
Uses the shared inputs: sourceList, itemPositionNumber.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | Any | The selected item, with its stored type. See the date tip below. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$, itemPositionNumber=1; bind result to $item$.
Expected result
$item$ is String b. Index 2 or any index in an empty list fails.
A date comes back as text. Save it in String or Any. To turn it into Datetime again, use Date and time Assign: option=constant, source=$dateText$, formatType=custom, customFormat=yyyy-MM-dd'T'HH:mm:ss.SSSSSSSXXX. For example, 2024-03-15T10:30:00.0000000+00:00 becomes 2024-03-15T10:30:00+00:00.
Join items (listJoinList)
Join the text of the items with a separator.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
delimiter | Delimiter | Stringdefault ""optional | Text inserted between adjacent items. Empty text joins without a separator. |
Uses the shared inputs: sourceList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | String | Joined String. Structured items contribute their compact JSON text. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$, delimiter=-; bind result to $joined$.
Expected result
$joined$ is a-b. Empty input gives an empty String.
Merge list (listMerge)
Join two Lists into one: first List, then second.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
first | Select first list | Listdefault []required | First List; its order controls the result. |
second | Select second list | Listdefault []required | List. |
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | Both Lists, with repeated items and stored types kept. |
Example
Create $first$ with Strings a, b, and $second$ with text b, c. Set firstList=$first$, secondList=$second$; bind result to $merged$.
Expected result
$merged$ is ["a","b","b","c"]. Two empty inputs give [].
Remove item (listRemove)
Remove an item by its number, and get the removed item.
Inputs
Uses the shared inputs: sourceList, itemPositionNumber.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | Any | Removed item with its stored JSON type. |
source | List | Shortened List. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$, itemPositionNumber=0. Bind result to $removed$ and sourceList to $items$.
Expected result
$removed$ is a; $items$ is ["b"]. Remaining indexes shift left. An invalid index fails.
Remove duplicates (listRemoveDuplicates)
Remove repeated items. The first one stays.
Inputs
Uses the shared inputs: inputList, caseSensitive.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | First occurrences, in original order. |
Example
Create $items$ with Strings b, a, B. Set inputList=$items$, caseSensitive=false; bind result to $unique$.
Expected result
$unique$ is ["b","a"]. With case sensitivity it is ["b","a","B"]. Empty input gives [].
Remove empty/blank Values (listRemoveEmptyValues)
Remove items that are empty or only spaces.
Inputs
Uses the shared inputs: inputList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | A copy, with the nonempty items and their types kept. |
Example
Create $items$ with Strings a, an empty String, three spaces, and text b . Set inputList=$items$; bind result to $filtered$.
Expected result
$filtered$ is ["a"," b "]. This action does not change the text it keeps. All blank items gives []; Number 0 and Boolean false are kept.
Reverse list (listReverse)
Make a copy with the item order reversed.
Inputs
Uses the shared inputs: inputList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | Reversed copy, last item first. |
Example
Create $items$ with Strings a, b, c. Set inputList=$items$; bind result to $reversed$.
Expected result
$reversed$ is ["c","b","a"]. $items$ stays unchanged. Empty input gives [].
Set item (listSet)
Replace an item by its number, and get the previous item.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
replace | Replace with | Anydefault ""optional | Any item. |
Uses the shared inputs: sourceList, itemPositionNumber.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | Any | Previous item with stored JSON type, not the replacement. |
source | List | Updated List. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$, itemPositionNumber=1, replaceWith=z. Bind result to $old$, and sourceList to $items$.
Expected result
$old$ is b; $items$ is ["a","z"]. List length does not change. An invalid index fails.
Shuffle list (listShuffle)
Put a copy of the List in random order.
Inputs
Uses the shared inputs: inputList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | A copy in random order. Every item is kept. |
Example
Create $items$ with Strings a, b, b. Set inputList=$items$; bind result to $shuffled$.
Expected result
$shuffled$ has three items: one a and two b values, in an unspecified order. The original order is possible. Empty input gives [].
Size (listSize)
Count all items in a List, also empty and repeated items.
Inputs
Uses the shared inputs: sourceList.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
size | Number | Item count; 0 when empty. |
Example
Create $items$ with Strings a, b. Set sourceList=$items$; bind size to $count$.
Expected result
$count$ is Number 2. Empty input gives 0.
Sort list (listSort)
Sort a copy of the List as text, so 10 comes before 2.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
sort | Sort order | Sortdefault ASCENDINGoptional | ASCENDING sorts from low to high character codes. DESCENDING reverses that order. |
Uses the shared inputs: inputList, caseSensitive.
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | A sorted copy. Types are kept. Items with the same text can change places. |
Example
Create $numbers$ with Numbers 2, 10, 1. Set inputList=$numbers$, sortType=ASCENDING, caseSensitive=false; bind result to $sorted$.
Expected result
$sorted$ is [1,10,2]. Descending order gives [2,10,1]. Empty input gives [].
Strip list items (listStripItems)
Remove spaces at the start and end of each item. All items become text, also values that were not Strings.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
input | Select list | Listdefault []required | List; each item becomes text, including non-Strings. |
Outputs
| Identifier | Type | Meaning |
|---|---|---|
result | List | Trimmed Strings; blank items become empty Strings and remain. |
Example
Create $items$ with Strings a , b , and two spaces. Set inputList=$items$; bind result to $trimmed$.
Expected result
$trimmed$ is ["a","b",""]. Empty input gives []; internal spaces are kept.
Conditions
List contains value (listCondition)
Compare the stored text with text, a Number or a Boolean. Different stored types can match.
Inputs
| Identifier | Editor field | Type; required; default | Use |
|---|---|---|---|
variable | List variable(contains value) | Listdefault []required | List. |
subtype | Type | Subtypedefault Stringoptional | String compares exact text and case. Number reads each item as a number with a decimal point. Boolean compares the lowercase text true or false. |
string | Value | Stringdefault ""optional | Used when subtype=; enter the exact text to find. |
number | Value | Numberdefault 0optional | Used when subtype=; enter a number or select a Number variable. Unparseable items are skipped. |
boolean | Value | Booleandefault Trueoptional | Used when subtype=: True searches for true, False for false, and Variable uses boolean. |
boolean | Boolean variable | Booleandefault falseoptional | Used only with Boolean subtype and boolean. Select a Boolean variable or enter true or false. |
Outputs
No output fields. Use the condition in a control step: true for a match, otherwise false.
Example
Create $items$ with Strings a, b. Set variable=$items$, subtype=String, stringValue=b. Use this condition on an If step.
Expected result
The evaluation is true. Changing stringValue to B gives false. An empty list gives false.