Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Highlighted
Partner
Partner

Unable to Create() table using QlikSense Visualization API

Hello, I am having trouble rendering a QlikSense table in my web application. I am making use of the Create() method defined here: https://help.qlik.com/en-US/sense-developer/February2018/Subsystems/APIs/Content/CapabilityAPIs/Visu...

This is how I am defining my table:

    "type": "table",

    "options":

"qHyperCubeDef": {

"qDimensions": [

  {

"qDef": {

"qFieldDefs": ["STUDENT.YEAR"],

"qFieldLabels": ["Year"],

},

  },

  {

"qDef": {

"qFieldDefs": ["STUDENT.ETHNICITY"],

"qFieldLabels": ["Ethnicity"],

  },

  }],

  "qMeasures": [

          {

  "qDef": {

  "qLabel": "Percent Met",

  "qDef": `

  =count({$<

  STATE_ASSESSMENT.TEST_NAME = {'MSTEP'},

  STATE_ASSESSMENT.PERFORMANCE_LEVEL_MET_FLAG = {1}

  >} STATE_ASSESSMENT.PERFORMANCE_LEVEL_MET_FLAG

  ) /

  count({$<

  STATE_ASSESSMENT.TEST_NAME = {'MSTEP'}

  >} STATE_ASSESSMENT.PERFORMANCE_LEVEL_MET_FLAG

  )

  `,

  },

}]

  }

I am fairly certain that nothing is wrong with the dimension or measure definitions because I have made the exact same definitions in a line chart, and it renders fine. Below is what my table looks like:

scrshot_04272018.PNG

As you can see, the top chart displays fine, but the table just shows Totals (ignore the chart/table view toggle above the chart).

Can anyone explain to me what I am doing wrong, or how I can troubleshoot further?

EDIT: Also, when I go into Developer Mode in Chrome, I get the following error on my console:

scrshot_04272018_2.PNG

1 Solution

Accepted Solutions
ErikWetterberg
Honored Contributor

Re: Unable to Create() table using QlikSense Visualization API

Hi,

There are several properties that are specific to tables, and it might krasch if they are missing. Your best chance to get it right is to create a table in the client and then take a look at the properties. You can do that with my DevTools extension https://github.com/erikwett/DevTool. probably you are missing some array, I think there is one called columnOrder.

Erik Wetterberg

4 Replies
ErikWetterberg
Honored Contributor

Re: Unable to Create() table using QlikSense Visualization API

Hi,

The create method you are linking to has three parameters:

  • type
  • cols
  • options

I don't see that structure in your snippet. What is possible is leaving cols empty and instead build the whole structure in the options parameter, but if you do that (which I guess is what you are trying) you need to get everything right, like the arrays for sortorder and columnorder or it will break. Probably the best way to do that is to check the structure of an existing table.

Or you could use the cols array, in that case the visualization API will fix the other arrays for you.

Erik Wetterberg

Partner
Partner

Re: Unable to Create() table using QlikSense Visualization API

I would like to do it by building the structure in the options parameter because I feel like it gives more control over the visualization. I found the cols argument to be less specific.

I've reviewed this option parameter closely and can't find what could be wrong with it. Additionally, this is the exact same argument I am passing to the line chart, but it is not displaying correctly for me in a straight table.

ErikWetterberg
Honored Contributor

Re: Unable to Create() table using QlikSense Visualization API

Hi,

There are several properties that are specific to tables, and it might krasch if they are missing. Your best chance to get it right is to create a table in the client and then take a look at the properties. You can do that with my DevTools extension https://github.com/erikwett/DevTool. probably you are missing some array, I think there is one called columnOrder.

Erik Wetterberg

Partner
Partner

Re: Unable to Create() table using QlikSense Visualization API

Erik,

Thank you very much for creating this extension. It has helped me and my time greatly for defining our visualizations.

I tried using it on a table and got qHyperCubeDef, but unfortunately I still wasn't able to resolve my issue. I came to the conclusion that the API we are using to create QlikSense visualizations in our ReactJS app was causing the issue (https://github.com/qlik-demo-team/qdt-components). No matter what we did, we couldn't get a straight table by defining the hypercube.

We ended up trying out a Pivot Table instead and got it to work using your extension. Thanks again!