Collection Commands (Template Language)
Command | Result Type | Description |
---|---|---|
Add(collectionName:Name, [key:Object], value:Object) | Void |
Adds a value to a list or a key-value pair to a dictionary. If a key is provided, the operation targets a dictionary; otherwise, it adds to a list. Parameters: The name of the collection, an optional key for dictionaries, and the value to add. Example: |
Clear(collectionName:Name) | Void |
Removes all items from a list or all key-value pairs from a dictionary. Parameter: The name of the collection to clear. Example: |
Get(collectionName:Name, indexOrKey:Object) | Object |
Returns an item from a list or a value from a dictionary based on an index or key. If the index is out of range or the key is not present, it returns null. Parameters: The name of the collection, and the index or key of the item to retrieve. Example: |
GetKeys(dictionaryName:Name) | Array |
Returns an array of all keys in the specified dictionary. Parameter: The name of the dictionary. Example: |
GetValues(dictionaryName:Name) | Array |
Returns an array of all values in the specified dictionary. Parameter: The name of the dictionary. Example: |
IsInList(collectionName:Name, item:Object) | Boolean |
Checks whether a list contains a given value or a dictionary contains a given key. Parameters: The name of the collection and the item (value or key) to check for. Example: |
Map(dictionaryName:Name, key:Object) | Object |
Returns the value associated with a key in a dictionary. If the key is not present, returns the key itself. Parameters: The name of the dictionary and the key to search for. Example: |
Remove(collectionName:Name, indexOrKey:Object) | Void |
Removes an item from a list or a key-value pair from a dictionary based on an index or key. Parameters: The name of the collection and the index or key of the item to remove. Example: |
Union(...collections:Collection) | Collection |
Returns a union of the input collections, combining items from lists or key-value pairs from dictionaries into a single collection. Parameters: A sequence of collections to unify. Example: |
New Comment