Tips on Using Queries
Different queries with the same result
You can obtain the same result using different queries.
Query diagrams of a project that describe an org-unit
• And between two conditions
Select Diagram where Described-Org-Unit and Project = &Project
• Query in an intermediate set and restrict to this set:
Select Diagram into @Org-UnitDiagram where Described-Org-Unit
Select Diagram from @Org-UnitDiagram where Project = &Project
• Query in two sets and find their intersection:
Select Diagram into @Org-UnitDiagram where Described-Org-Unit
Select Diagram into @ProjectDiagram where Project = &Project
Select Diagram from @Org-UnitDiagram and @ProjectDiagram
Query messages of a project
• Extended form using a sub-queries
Select Message where Diagram in Diagram where Project = &Project
• Browsing the links
Select Message Where Diagram.Project = &Project
Query org-units without a Message-Sent
Select Org-Unit where [Message-Sent] null
Select Org-Unit where not [Message-Sent]
Tips with "and", "not" and "or" operators
It is important to ensure that the query corresponds to the desired search, particularly when using the "and", "not" and "or" operators.
The following query:
Select Org-Unit where not [Message-Received] = "Order"
gives all the org-units except those that receive the “Order” message. The org-units that do not receive a message are also included in the result.
However, the following query:
Select Org-Unit where [Message-Received] not = "Order"
selects only the org-units that receive a message except those that receive the “Order” message.
To obtain the same result as above, write:
Select Org-Unit where [Message-Received] not = "Order" or [Message-received] null
Other query examples
Query messages always sent by an org-unit
Select Message into @obl where Source-Org-Unit = &Org-Unit and Source-Org-Unit.Predicate = ”always”
finds the messages sent by the org-unit entered as the setting value, and connected to any org-unit with the source predicate = ”always”.
Select Message into @obl where Source-Org-Unit.(name = &Org-Unit and Predicate = ”always”)
finds the messages sent by the org-unit entered as the setting value, with the source predicate = ”always”.
Check validity of link used
Similarly, when counting links, you should check the link:
Select Diagram where Org-Unit.[Message-Sent] not null having count >= 3
finds diagrams having at least three messages sent by the org-units in these diagrams.
Use the following query to find diagrams having org-units sending at least three messages:
Select Diagram where Org-Unit in Org-Unit where
Message-Sent not null having count >= 3
Examples of queries on reflexive links
• Use the following query to find org-units that are part of the "Sales Management" department (and are therefore aggregations of this department):
Select Org-Unit where Aggregation-Of = "Sales Management"
• Query to find org-units that are directly or indirectly part of the “Sales Management” department (which are aggregations of the “Sales Management” department or one of its components):
Select Org-Unit where Aggregation-Of deeply = "Sales Management"
• Query to find org-units that are part of an org-unit other than the “Sales Management” department:
Select Org-Unit where Aggregation-Of deeply not = "Sales Management"
• Query to find org-units that are not part of the "Sales Management" department:
Select Org-Unit where not Aggregation-Of deeply = "Sales Management"
• Query to find org-units that are not components of something or are part of the "Sales Management" department:
Select Org-Unit where not Aggregation-Of deeply not = "Sales Management"
Examples with diagram, org-unit, message and keyword
• Use the following query to find diagrams connected to at least one org-unit that receives at least one message with a keyword:
Select Diagram Where Org-Unit. [Message received]. Keyword
• Use the following query to find diagrams connected to an org-unit that receives no messages without a keyword:
Select Diagram where Org-Unit.(not Message-Received.(not Keyword))
OR
or Select Diagram where Org-Unit.(not Message-Received.Keyword null)
• Use the following query to find diagrams connected to an org-unit that receives messages that all have a keyword:
Select Diagram where Org-Unit.(Message-Received and not Message-Received.(not Keyword))
OR
Select Diagram where Org-Unit.(Message-Received and not Message-Received. Keyword null)
• Use the following query to find diagrams that have only org-units that receive messages without a keyword:
Select Diagram where not Org-Unit.(not Message-Received.(not Keyword))
• Use the following query to find diagrams whose org-units all receive messages that all have a keyword:
Select Diagram where Org-Unit and not Org-Unit.(not Message-Received or Message-Received.(not Keyword))