buildCollection
A logic command that creates a Collection whose contents can be initialized with any logic commands that create variables.
Every child command of buildCollection
that normally creates a variable will not create that variable, but instead add a new item into the Collection being created by this parent command. The variable's value will be the item to add, while the variable's name is ignored.
Child commands
Any variable-creating or control command can be a child of buildCollection
.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the name of the variable that will hold the new Collection. |
Examples
The buildCollection
command is helpful if you want to create a Collection initalized with values that require specific commands to be created with. For example, if you'd like to create a Collection of Files downloaded from Salesforce, you can use buildCollection
with load child commands:
<buildCollection var="files"><load var="a" recordId="${firstFileId}"><load var="a" recordId="${secondFileId}">
Since the name of the variable created by the child commands is ignored by buildCollection
, the var
can be anything, but as it is still a required attribute for most variable-creating commands, you have to give it a value of some kind.
Control commands can also be used within buildCollection
to have the content initialization become a bit more dynamic. A File Collection like the one before could be built with a forEach:
<buildCollection var="files"><forEach var="fileId" value="${fileIds}"><load var="a" recordId="${fileId}">