You can translate the question and the replies:

Multivalued variables from a query in %CONTEXT directive

Hi, is there a way to retrieve multivalued variables from a query in the %CONTEXT directive ? For example, I want to compare the count between views in Denodo and their datasources in DB2 : ``` %CONTEXT viewnames[] = a, b, c schemavdp = eicorea schemadb2 = a prefixe = puv_ %EXECUTION[query] { ds:vdp } select count(1) as RESULT from ${schemavdp}.${prefixe}${viewnames} %RESULTS[query] { ds:db2 } select count(1) as RESULT from ${schemadb2}.${viewnames} ``` To obtain views list i use a query like this one : ``` select viewname from syscat.views where viewschema not like 'SYS%' and viewschema = 'ABC' order by viewname ``` Is there a way to specify the query in the context directive instead of results of this query, to insure the test is always up to date ? thanks
user
06-08-2020 08:18:52 -0400

1 Answer

Hi, I am able to successfully run the test by specifying the direct query into a Multivalued variable in the %CONTEXT directive. For eg ``` %CONTEXT qry[] = select * from actor,select * from city ``` But this method works only when the Denodo view names are the same as the datasource table/view name.After defining the %CONTEXT directive as shown in the above example, I would use the variables ${qry} inside the %EXECUTION AND %RESULTS directive by specifying the directive qualifier called “query”. Also I would prefer to define the view name instead of direct query in a multivalued variable when the Denodo view names are different from the datasource table/view name. Because, when the directive has more than one multivalued values the test will be run with the each possible combination of the values and the result of such test run would fail for some combination. To know more about this behaviour, you could refer to the [CONTEXT DIRECTIVE](https://community.denodo.com/docs/html/document/denodoconnects/7.0/Denodo%20Testing%20Tool%20-%20User%20Manual) Section of the Denodo Testing Tool - User Manual Hope this helps!
Denodo Team
07-08-2020 09:40:37 -0400
You must sign in to add an answer. If you do not have an account, you can register here