Add $items to expression and Function-Nodes to get all items

This commit is contained in:
Jan Oberhauser
2020-04-12 18:42:29 +02:00
parent 135e467be9
commit 09e528565f
4 changed files with 114 additions and 50 deletions

View File

@@ -59,7 +59,7 @@ return newItems;
```
#### Method: $item(index)
#### Method: $item(index: number)
With `$item` it is possible to access the data of parent nodes. That can be the item data but also
the parameters. It expects as input an index of the item the data should be returned for. This is
@@ -88,6 +88,28 @@ const channel = $item(9).$node["Slack"].parameter["channel"];
```
#### Method: $items(nodeName?: string, outputIndex?: number, runIndex?: number)
Gives access to all the items of current or parent nodes. If no parameters get supplied
it returns all the items of the current node.
If a node-name is given, it returns the items the give node did output. By default of the
first output (index: 0, most nodes only have one output, exceptions are IF and Switch-Node)
and the current run.
Example:
```typescript
// Returns all the items of the current node and current run
const allItems = $items();
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of current run)
const allItems = $items("IF");
// Returns all items the node "IF" outputs (index: 1 which is Output "false" of run 0 which is the first one)
const allItems = $items("IF", 1, 0);
```
#### Variable: $node
Works exactly like `$item` with the difference that it will always return the data of the first item.