Start a new topic
Answered

"Any...has" function in SemQL

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?


Best Answer

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.


Answer

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.

I have 2 questions regarding these ANY/ALL SemQL clauses:

1 -  How does the following SemQL condition behaves  in the situation of  a Parent record not having any Children Contacts ? 

               NOT ANY Contact HAS (1=1)

Does it returns TRUE or FALSE?


2 -  When using those ANY/ALL SemQL conditions,  is there any way to enforce Semarchy xDM to perform the search only in the SD Tables? 
      There is  some contexts where we only want to validate the information existing in the scope of the current load,  and so it could be useful  to prevent xDM from querying the MD tables.

Login to post a comment