« Back

Query AdoScript AQL_EXPRESSION using variable names?

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Query AdoScript AQL_EXPRESSION using variable names?
query adoscript expr eval_aql_expression
Answer
8/10/18 8:52 AM
Hello,

How can i use variables in AdoScript queries ?

Example Code:
CC "AQL" EVAL_AQL_EXPRESSION expr:"({\"A\":\"B\"}<-\"Is inside\")"  modelid: (modelid)

This code works is gets all elements inside element "A" which has the type "B".

But now i want to use instead of the hardcoded string "A" a  variable to get the elements inside depending on the variable.

Can you please help me with the syntax and post also the link to the documenation.

BR
Martin

RE: Query AdoScript AQL_EXPRESSION using variable names?
query adoscript query adoscript eval_aql_expression
Answer
8/10/18 10:37 AM as a reply to Martin Paczona.
Hallo Martin,

you can use the „+“ operator for concatenation of Strings.

Example: Get all objects of class B, which are inside the class V:
1) Without a variable:
1CC "Modeling" GET_ACT_MODEL
2CC "AQL" EVAL_AQL_EXPRESSION expr:("<\"V\"><-\"Is inside\">\"B\"<") modelid: (modelid)

2) Using a variable:
1CC "Modeling" GET_ACT_MODEL
2SETL sClass:("V")
3CC "AQL" EVAL_AQL_EXPRESSION expr:("<\"" + sClass + "\"><-\"Is inside\">\"B\"<") modelid: (modelid)