Skip to main content
Question
Anonymous
Asked a question 2 years ago

Could someone describe how SemQL function any...has(something=something) works? What is difference when has is replaced with have? What are the supported parameters in this function? What else should I know when using this any..has(..) function?

Where am I?

In Semarchy Community you can ask and answer questions and share your experience with others!

Marc SpicaSemarchy Team
Sr Customer Success Consultant at Semarchy

The any/all SemQL syntax allows you to query child entities records.

any/all <child_entity_role> have/has ( <condition_on_child_entity> )

"any" means at least one record from the child entity follows the condition.

"all" means all records from the child entity follow the condition.

"has" and "have" behave exactly the same, they exist only for the expression to be grammatically correct, but you may use one or the other interchangeably.

A good tip is to use 1=1 as a condition when the goal is just to check child records existence without any other specific criteria. For example, either of these will return true if at least one contact exists for the parent record:

  • ANY Contact HAS (1=1)
  • ANY Contact HAS ( ID IS NOT NULL )

More details and examples in this documentation https://www.semarchy.com/doc/semarchy-xdm/semsq.html#child-entities190