Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sri_c003
Partner
Partner

Web Socket - get field description - for fields formed using measures

We are trying to get qlik sense field level details using websocket api (backend calls, not on UI) and facing issue while fetching field description for dynamic fields (made of measures).

I created an app, a sheet within it, and created two filters - one for "age" and one based off age "=If([age]<=50,50,100)".

Then connected to it via devhub and am trying to fetch the field description.

1. Opened the doc

sri_c003_0-1614873347407.png

2. Made the call to get the details of the "age" field

This worked fine getting us the necessary details.

sri_c003_1-1614873498441.png

3. Updated the same call to get the details of the "=If([age]<=50,50,100)" field

And here it is where it is errors out saying "invalid params".

sri_c003_2-1614873614407.png

Is this unsupported? Is there any workaround for this? We are trying to explore options to be able to fetch the description of fields constructed using measures.

Any help would be appreciated.

3 Replies
sri_c003
Partner
Partner
Author

Anyone...?

yko
Employee
Employee

I'm pretty sure that the "GetFieldDescription" only supports field names as argument. A field is a static concept in the app that is produced when you reload the app and if I understand it correctly, that is the information accessed by that method. Dimensions, though closely related to fields, are not fields, and the expression you use in the failing call is an expression used to define a calculated dimension. The data for such a dimension (cardinality etc) will depend on the selection state of the engine and will therefore require calculations from the engine on the fly.

But! If you do want to get information regarding such a dimension, then what you could do is to create a generic session object with a list object in it and use the calculated dimension there. Then you will get information about the dimension in qDimension property of the layout of the list object:

https://help.qlik.com/en-US/sense-developer/February2021/APIs/EngineAPI/definitions-ListObject.html

sri_c003
Partner
Partner
Author

Thank you @yko, that is an interesting approach. This could possibly help for gathering information about standalone dimensions, let me try this out.

Here is what we are trying to achieve:

A user can go to app sheet, pick any filters he wants, and then sends this info to back end. In the back end we connect to Qlik using web socket, create a temporary session, load the table object into the session and then apply filters on top of it. And then this filtered data is returned back to the user.

Here is a situation where the data is a little more complex - say we have a table with column names as below:

  • name
  • age
  • =If([age]<=50,50,100)
  • location

One more consideration here is that these tables could be created by users with whatever column names they may want. We wouldn't always know what the field is that is creating the dimension. And also there could be multiple dimensions that could be selected for filtering data.

Note: This approach worked for us for as long as we used static fields for filters (inclusive of the scenario where the other column names in the table may contain calculated values).

Any guidance on how we could possibly approach this would be greatly appreciated.