Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nazakc
Contributor
Contributor

How to filter on a Qlik Expression from the engine API

Hi, I am very, very new to QS. I am tasked with maintaining a legacy app that communicates with QS using the engine api which I have been playing with a bit but i am very far from finding how to do what i want to do with it

I realize my vocabulary can be a bit confusing but I am gonna try to make myself as clear as possible, so please bear with me.

I have an expression that evaluates to one of two field, my front end app has to filter on the fields but only have access to the expression:

let's call the expression vCompanyName. vCompanyName evaluates to either companyCodeAndName or companyRegistryCode.

my FE app needs to filter but only has access to vCompanyName.

Logically i would do the following:

step 1: call EvaluateEx on vCompanyName. This would yield either companyCodeAndName or companyRegistryCode

step 2: call GetField on the value returned from step 1

step 3: call Select on that field with the value i want to filter with

This however is error prone when and if other filters are being set that could impact the evaluation of vCompanyName.

what is the best way to go about this? is there a method in the api that allows me to filter using an expression?

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I assume at some point after filtering you are retrieving  data from Qlik, likely in a Hypercube.  You can use Set Analysis syntax in your hypercube Measures to include filtering with your data definition.  For example, instead of 

Sum(Sales)

with set filtering to three companies:

Sum({<companyRegistryCode={'AGX', 'YHO', 'IBM'}>} Sales)

If you have more questions tell us a bit more about what methods you are using to retrieve data and what programming language you are using. 

-Rob