Document Viewer

« Back

HandsOn Query 4: Combine AQL with Logical Operators

Get all objects that are situated inside the object V1 or object V1 is situated inside them plus all instances of class A

CC "Modeling" GET_ACT_MODEL

# make first query with all objects inside V1
CC "AQL" EVAL_AQL_EXPRESSION expr: "({\"V1\":\"V\"}<-\"Is inside\")
                                 OR ({\"V1\":\"V\"}->\"Is inside\")"
                             modelid: ( modelid )
SETL st1: ( objids )

# make second query with all A in model
CC "AQL" EVAL_AQL_EXPRESSION expr: "(<\"A\">)"
                             modelid: ( modelid )
SETL st2: ( objids )

# union of the two AQL result sets
SETL st_allobjectids: ( tokunion (st1,st2))
IF (ecode = 0) {
    CC "AdoScript" INFOBOX ("Found objects: " + st_allobjectids)
}
ELSE {
    CC "AdoScript" INFOBOX "An error has occured!"
}