Skip to content

Commit 7957b51

Browse files
committed
Add documentation for list_as() Fix bind. (#268)
1 parent faede4b commit 7957b51

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,26 @@ end
680680

681681
#### `do list_as`
682682

683-
TODO
683+
Iterates over each _named_ element of an array (like [`do list`](#do-list) with a variable name). If multiple arrays are given, iterates over the _corresponding_ elements from each array (i.e., all elements with the same array index, skipping elements whose arrays have already been exhausted).
684+
685+
```perl
686+
do list_as(element_1: "<sourceField_1>"[, ...])
687+
...
688+
end
689+
```
690+
691+
E.g.:
692+
693+
```perl
694+
# "ccm:university":["https://ror.org/0304hq317"]
695+
# "ccm:university_DISPLAYNAME":["Gottfried Wilhelm Leibniz Universität Hannover"]
696+
set_array("sourceOrga[]")
697+
do list_as(orgId: "ccm:university[]", orgName: "ccm:university_DISPLAYNAME[]")
698+
copy_field(orgId, "sourceOrga[].$append.id")
699+
copy_field(orgName, "sourceOrga[].$last.name")
700+
end
701+
# {"sourceOrga":[{"id":"https://ror.org/0304hq317","name":"Gottfried Wilhelm Leibniz Universität Hannover"}]}
702+
```
684703

685704
#### `do once`
686705

0 commit comments

Comments
 (0)