Skip to content

Functions on sets

Description

Some functions, usually those used to navigate trees of aggregation structures, return sets of elements on which the user can operate with specific functions and operators.

The And function

Element Description
Availability From 3.0903
Syntax * or &
Value returned Intersections between sets

Example

$Category.getNode("01").lowest * $Category.getNode("02").lowest

Returns the set made up of the lowest level elements simultaneously related to nodes "01" and "02" of the categories group.

The Or function

Element Description
Availability From 3.0903
Syntax + or /
Value returned Union between sets. Duplicates are deleted.

Example

$Entity.allAncestors(2) + $Entity.children

Returns the set made up of the parent, grandparent and children of the current node.

The Complement function

Element Description
Availability From 3.0903
Syntax -
Value returned Difference between sets (complementary set)

Example

$Entity.allDescendants(5) - $Entity.children

Returns all descendants up to the fifth level, excluding the children of the entity node to which it is applied.

The Contains function

Element Description
Availability From 3.0903
Syntax contains(element)
Parameters element: element to be searched for in the set, defined as a string between inverted commas or dimensional function
Value returned 1 if the element parameter belongs to the set, otherwise 0.

Example

Entity.lowest.contains($Entity.getLeaf(“A01"))

Returns 1 if the descendants of the entity node include entity "A01", otherwise it returns 0.

The Item function

Element Description
Availability From 3.0903
Syntax item(index)
Parameters index: index identifying the element belonging to the set
Value returned Element of the set with index specified as a parameter (0-based). Returns an error if the set has an index lower than the indicated index+1 children.

Example

$Entity.children.item(0): returns the first child of the node of entities.

$Entity.children.item(1): returns the second child of the node of entities.

The Err() function

Element Description
Availability From 4.3.1
Syntax err()
Value returned Always returns an error.

The Iserror function

Element Description
Availability From 4.3.1
Syntax iserror(argument)
Parameters argument: generic function
Value returned TRUE if the processed argument is an error, otherwise FALSE.

The Set Function

Element Description
Availability From 3.0903
Syntax set(element1, element2, ...elementN)
Parameters elemento1 elemento2 element<...>: elements that will form part of the set, defined as a string between inverted commas or dimensional function
Value returned Creates a set with the parameters processed as elements. Note: if one of the arguments is an error, the system will return a set containing only the elements that do not return errors.

Example

Set($Entity.getNode("C1"), $Entity.getNode("C2"))

Set containing nodes C1 and C2 of the entity hierarchy specified in the filter.

The Size function

Element Description
Availability From 3.0903
Syntax size
Value returned Number of elements in the set

Example

$Entity.children.size

Returns the number of sheets in the node of the entity hierarchy specified in the filter.

The Sum/Intersect function

Element Description
Availability From 3.0903
Syntax sum(set1, set2, ... set<...>), intersect(set1, set2, ... setN)
Parameters set <...>: set of objects to be united or intersected with the sets specified in the subsequent parameters.
Value returned Union and intersection between the sets indicated as parameters

Example

Let us consider two variables, a and b, defined as follows:

a := Set($Entity.getNode("C1"), $Entity.getNode("C2"));

b := Set($Entity.getNode("C3"), $Entity.getNode("C4"));

sum(a, b)

Returns a set containing nodes C1, C2, C3 and C4 of the entity hierarchy specified in the filter.

The TrimSet function

Element Description
Availability From 3.0903
Syntax trimSet(numElements)
Parameters numElements: number of elements, starting with the first, that you want to consider.
Value returned The first "numElements" of the set. If the set contains fewer elements, they are all returned.

Example

$Entity.lowest.trimSet(3)

Returns the first three entities belonging to the sub-tree of the entity hierarchy node to which the specified entity belongs.