Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rocklog
Contributor
Contributor

Adding measures to table with Engine API

Hello,

I've been trying to add a large amount of columns to a table with the Engine API, since otherwise it would be terribly time consuming and numbing  to do manually. Of course, now it has taken maybe more time than if it had been done manually, but maybe I could use this in a future case as well.

So, I have created all the master measures I need programatically (100+) and I can add them in different ways to a table. However, none of the ways I've tried allow me to actually see the measures/dimensions added in the Qlik UI. When I move to edit the sheet, and choose the table, I see no measures/dimensions on the right side "Columns"-box.

I have tried making a table manually and looking at the properties and comparing to the one made with the API. I have made a table in the UI and then added the measures with the API, yet it still doesn't work. I have tried creating a new object, doing it with patches, adding the qType, changing the column orders, adding qInitialDataFetch, looking at the network tab to find out if something's missing, and some other things as well.

At some point I managed to get them on the right side bar but then I couldn't replicate it anymore. If I add only a few, it does seem to work, but when I try adding the whole bunch, it breaks down.

Any ideas what I could try? Is there some property I'm missing? Do I need to add some meta-info to the table-object? Or is this possible to do in the first place?

Labels (2)
2 Replies
Damien_Villaret
Support
Support

Hello @rocklog 

There's an example on how to do it with dimensions here:

It should be similar for measures too.
 
Hope that helps.
 
Best regards,
If the issue is solved please mark the answer with Accept as Solution.
Øystein_Kolsrud
Employee
Employee

Just adding the basic definition of the measure is fine if you just want to extract data programmatically through the API, but the trick here is to figure out which properties you need to set to make it possible for the client to render the visualization correctly. Those requirements are unfortunately not considered part of the API, so reverse engineering is typically the only option. If you look at the example that @Damien_Villaret linked to, you'll see that there are two such properties that need to be set for a table visualization to be correctly rendered:

  1. Each inline dimension needs to be assigned a unique "cId". I think the 'c' here is short for "client".
  2. The hypercube needs an array of integers representing column widths which needs to have one entry per measure and dimension. A value of -1 means "use default value".

But keep in mind that the exact set of properties you'll need will depend on which visualization you use.