To retrieve all the parent names, we use this expression: Code Block |
---|
COLLECT Parent.name
FROM
COLLECT Person
FROM ALL Person
WHERE ( Person.hasChildren != ? ) NAMED Parent |
This expression results in “Rick”, “Julia” and “Joan”. To retrieve all children names, we use this expression: Code Block |
---|
COLLECT Child
FROM (
COLLECT Person.hasChildren
FROM ALL Person
WHERE ( Person.hasChildren != ? ) ) NAMED Child |
This expression results in a collection of three instances of Person (i.e Person_1 , Person_3 and Person_5 , with names Kim, Bob and Sam). To retrieve all children younger than 15, we use this expression: Code Block |
---|
COLLECT Child
FROM (
COLLECT Person.hasChildren
FROM ALL Person
WHERE ( Person.hasChildren != ? ) ) NAMED Child
WHERE ( Child.Age < 15 ) |
This expression results in a collection of two instances of Person (i.e Person_3 and Person_5 , with names Bob and Sam). To retrieve the children’s names with a parent older than 40 years: Code Block |
---|
COLLECT Child.Name
FROM (
COLLECT Person.hasChildren
FROM ALL Person
WHERE ( Person.hasChildren != ? AND Person.Age > 40 ) ) NAMED Child |
This expression results in a collection with only the name “Kim”. You can make it as complex as you like, for example: Code Block |
---|
COLLECT Child.Name
FROM (
COLLECT Parent.hasChildren
FROM (
COLLECT Person
FROM ALL Person
WHERE ( Person.hasChildren != ? ) ) NAMED Parent
WHERE ( Parent.Age > 40 )
) NAMED Child
WHERE ( Child.Age < 18 ) |
This expression results also in a collection with only the name “Kim”. UI Text Box |
---|
| In some occasions, a local variable could be a good alternative for using an alias. E.g. if you want a collection of all persons except the person that is currently active, this would be simple and transparent: Code Block |
---|
thisPerson := Person ;
COLLECT Person
FROM ALL Person
WHERE ( Person != thisPerson ) |
|
Include Page |
---|
| _nav_BackToTop |
---|
| _nav_BackToTop |
---|
|
|