Collect Function

Relevance:
Variable occurrences within this function do not contribute towards the overall relevance of those variables.
Consequently, such variables must occur in at least one other context for them to be considered relevant.
This function is non-evaluable if it does not reference a question variable because the repeat context of the question variables is what drives the repetitions to be collected.
Description 1 of 4 (collect a list of repeated values):
A list of repeated values.
Returns:
Any*
Parameter:
Parameter
Data Type
Description
1
Any
The repeated expression for each returned value.
Examples:
In the following examples, consider there are two companies named Alpha Holdings, Beta Construction. Consider also that the directors of the first company are John (male aged 40), Mary (female aged 30), Eva (female aged 30) and Michael (male aged 35) and that the directors of the second company are Ted (male aged 35) and Anthony (male aged 30).
Expression
Result
[
Repeat 2
{Collect( DirectorName )}]
List( "John", "Mary", "Eva", "Michael" )
for the first company, and
List( "Ted", "Anthony" )
for the second company
[
Repeat 2
{Collect( DirectorAge )}]
List( 40, 30, 30, 35 )
for the first company, and
List( 35, 30 )
for the second company
{Collect( DirectorAge )}
List( 40, 30, 30, 35, 35, 30 )
Description 2 of 4 (collect a list of repeated values where other repeated values are true):
A list of repeated values for which other correspondingly repeated values are known and true.
Returns:
Any*
Parameters:
Parameter
Data Type
Description
1
Any
The repeated expression for each returned value.
2
Boolean
The corresponding repeated expression which is true.
Examples:
In the following examples, consider there are two companies named Alpha Holdings, Beta Construction. Consider also that the directors of the first company are John (male aged 40), Mary (female aged 30), Eva (female aged 30) and Michael (male aged 35) and that the directors of the second company are Ted (male aged 35) and Anthony (male aged 30).
Expression
Result
[
Repeat 2
{Collect( DirectorName, DirectorAge IsLessThan 30 )}]
List( "John", "Michael" )
for the first company, and
List( "Ted" )
for the second company
[
Repeat 2
{Collect( DirectorName, DirectorGender Is "Male" )}]
List( "John", "Michael" )
for the first company, and
List( "Ted", "Anthony" ) for the second company
{Collect( DirectorName, DirectorGender Is "Male" )}
List( "John", "Michael", "Ted", "Anthony" )
Description 3 of 4 (collect an ordered list of repeated values where other repeated values are true):
A list of repeated values for which other correspondingly repeated values are known and true. The values are collected in the order of yet other correspondingly repeated values.
Returns:
Any*
Parameters:
Parameter
Data Type
Description
1
Any
The repeated expression.
2
Boolean
The corresponding repeated expression which is true.
3
Any
The corresponding repeated expression determining the order of the collected values.
Examples:
In the following examples, consider there are two companies named Alpha Holdings, Beta Construction. Consider also that the directors of the first company are John (male aged 40), Mary (female aged 30), Eva (female aged 30) and Michael (male aged 35) and that the directors of the second company are Ted (male aged 35) and Anthony (male aged 30).
Expression
Result
[
Repeat 2
{Collect( DirectorName, true, DirectorAge )}]
List( "Mary", "Eva", "Michael", "John" )
for the first company, and
List( "Anthony", "Ted" )
for the second company
[
Repeat 2
{Collect( DirectorName, true, Inverse(DirectorAge) )}]
List( "John", "Michael", "Mary", "Eva" )
for the first company, and
List( "Ted", "Anthony" )
for the second company
{Collect( DirectorName, DirectorGender Is "Male", DirectorAge )}
List( "Anthony", "Michael", "Ted", "John" )
Description 4 of 4 (collect an ordered list of repeated values where other repeated values are true):
A list of repeated values for which other correspondingly repeated values are known and true. The values are collected in the order of yet other correspondingly repeated values. The repetitions considered are determined by yet other correspondingly repeated variables.
Returns:
Any*
Parameters:
Parameter
Data Type
Description
1
Any
The repeated expression.
2
Boolean
The corresponding repeated expression which is true.
3
Any
The corresponding repeated expression determining the order of the collected values.
4
Any
The corresponding repeated variables that determine which repetitions are considered.
Examples:
In the following examples, consider there are two companies named Alpha Holdings, Beta Construction. Consider also that the directors of the first company are John (male aged 40), Mary (female aged 30), Eva (female aged 30) and Michael (male aged 35) and that the directors of the second company are Ted (male aged 35) and Anthony (male aged 30).
Expression
Result
[
Repeat 2
{Collect( RepeatCounter, true, DirectorAge, DirectorName )}]
List( "2", "3", "4", "1" )
for the first company, and
List( "2", "1" )
for the second company
[
Repeat 2
{Collect( RepeatContext, true, DirectorAge, DirectorName )}]
List( "[1][2]", "[1][3]", "[1][4]", "[1][1]" )
for the first company, and
List( "[2][2]", "[2][1]" )
for the second company
{Collect( RepeatContext, true, DirectorAge, DirectorName )}
List( "[1][2]", "[1][3]", "[2][2]", "[1][4]", "[2][1]", "[1][1]" )

Related content