Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
bgColorwhite

EXISTS


Determines whether an instance of a specified entity exists, optionally meeting certain criteria.


Syntax

Code Block
EXISTS instances [ WHERE ( condition ) ]


Inputs
  • instances - Instances to search.
  • condition - boolean expression that represents the criterion the instance has to meet.


Return type

  • boolean


Examples

Suppose the following data model.


Person.namePerson.genderPerson.age
“Kim”?23
“Rick”“m”35
“Bob”“m”42
“John”“m”19
“Mary”“f”33
ExpressionResultType
EXISTS PersonTRUEboolean
EXISTS Person WHERE ( Person.age < 18 ) FALSEboolean
EXISTS Person WHERE ( Person.gender = "m" AND Person.age > 35 )TRUEboolean
EXISTS Person WHERE ( Person.gender = "f" AND Person.age < 25 )UNKNOWNboolean
EXISTS Person WHERE ( Person.age < 25 AND Person.gender = "f" )FALSEboolean
EXISTS Person WHERE ( Person.gender = ? )TRUEboolean
note
UI Text Box
type
Info

Please note that you can use a COLLECT expression as well for collecting instances for which the EXISTS should hold. E.g., EXISTS (COLLECT Person FROM ALL Person WHERE (Person.gender = "f")) WHERE ( Person.age < 25 ).

In case that the list of instances for which the EXISTS should hold is an EMPTY list, then the EXISTS expression returns FALSE.

Back to top

...