Collection
- Last Updated: March 18, 2022
- 1 minute read
- Corticon.js
- Documentation
Corticon.js's Collection operators are as follows:
| Name and Syntax | Returns | Description | |
|---|---|---|---|
| Replace element(s) | |||
< < |
modifies a collection | replaces all elements in <Collection1> with elements of <Collection2> or with <Entity>, provided the new associations are allowed by the
Business Vocabulary. |
|
| Associate element(s) | |||
|
< < |
modifies a collection | Associates all elements of <Collection2> or <Entity>
with <Collection1>. Every <Collection> must be expressed as a unique
alias. |
|
| Disassociate element(s) | |||
<Collection1> -=
<Collection2> |
modifies a collection | Disassociates all elements of <Collection2> from <Collection1>. Does not delete the disassociated elements. Every
<Collection> must be expressed as a
unique alias. |
|
| Is empty | |||
<Collection>
->isEmpty |
Boolean | Returns a value of true if <Collection> contains no elements |
|
| Not empty | |||
<Collection>
->notEmpty |
Boolean | Returns a value of true if <Collection> contains at least one
element. |
|
| Exists | |||
<Collection>
->exists (<Expression>) |
Boolean | Returns a value of true if <Expression> holds true for at least one
element of <Collection> |
|
| For all | |||
<Collection>
->forAll (<Expression>) |
Boolean | Returns a value of true if every
<Expression> holds true for every element of <Collection> |
|
| Sorted by | |||
<Collection>
->sortedBy (<Attribute>) |
converts a collection into a sequence |
Sequences the elements of < |
|
| Sorted by descending | |||
<Collection>
->sortedByDesc (<Attribute>) |
converts a collection into a sequence | Sequences the elements of <Collection> in descending order,
using the value of <Attribute> as the
index. <Collection> must be expressed
as a unique alias. |
|
| Size of collection | |||
<Collection>
->size |
Integer | Returns the number of elements in <Collection>. <Collection> must be expressed as a unique alias. |
|
| Sum | |||
<Collection.attribute> ->sum |
Number | Sums the values of the specified <attribute> for all elements in <Collection>. <attribute> must be a numeric data type. |
|
| Average | |||
<Collection.attribute> ->avg |
Number | Averages all of the specified attributes in <Collection>. <Collection> must be expressed as a unique alias. <attribute> must be a numeric data type |
|
| Minimum | |||
<Collection.attribute> ->min |
Number | Returns the lowest value of <attribute> for all elements in <Collection>. <attribute> must be a numeric data type |
|
| Maximum | |||
<Collection.attribute> ->max |
Number | Returns the highest value of <attribute> for all
elements in <Collection>. <attribute> must be a numeric data type |
|