Columns

The cols parameter defines the visualization's hypercube . The number of columns you need to specify depends on the visualization. If you specify too few columns, you will get an Incomplete visualization error, just as if you created it in the client.

The order of the columns are in some cases not important. For a basic bar chart with one dimension and one measure, the columns can be specified in any order. However, for a table it does matter in which order the columns are specified. The order you specify in the cols parameter is the order that will be shown in the table.

There are three different ways of specifying the columns:

The above three methods can be combined in the same statement. You can use a simple string syntax for one column, a more advanced object for another and a predefined master measure for the third.

String syntax

If a string starts with =, it will be treated as a measure, otherwise it is treated as a dimension.

<qlik-visual appid="Helpdesk Management.qvf"
	type="barchart"
	cols='["Case Owner Group","=Avg([Case Duration Time])"]'
	options='{"title" : "On the fly barchart"}' >
</qlik-visual>
Note: Using the string syntax is quite easy but at the same time there are some limitations. If you want to set labels or limit the dataset to only the top five values, you should use the object syntax instead.

Object syntax

Use the object syntax if you want to set more options for your columns. If you. for example, create a pivot table with labels, you should use qFieldLabels for dimensions and qLabel for measures.

<qlik-visual appid="Helpdesk Management.qvf"
  type="pivot-table"
  cols='[
    "Year",
    {"qDef": {"qFieldDefs": ["Case Owner Group"], "qFieldLabels": ["Group"]}},
    {"qDef": {"qDef": "=Avg([Case Duration Time])", "qLabel": "Avg Case Duration Time"}},
    {"qDef": {"qDef": "Sum( [Open Cases] )", "qLabel": "Open Cases"}}
  ]'
  options='{ "title" : "Case Owner Group Case stats per year" }'>
</qlik-visual>

You can limit the data set to only show the top five values using qOtherTotalSpec.

<qlik-visual appid="Helpdesk Management.qvf"
  type="barchart"
  cols='[
    {
      "qDef": {"qFieldDefs": ["Case Owner Group"]}, "qOtherTotalSpec": {qOtherMode: "OTHER_COUNTED", qOtherCounted: "5"}
    },
    "=Avg([Case Duration Time])"
  ]'
  options='{ "title" : "Barchart with others" }'>
</qlik-visual>

The full list of available options is documented in the Engine API documentation.

Using predefined dimensions and measures

You can use dimensions and measures that are predefined in the app. This is mostly relevant if the user should be able to select dimensions and measures from lists. You must know the Dimension ID or the Measure ID, which is defined in the qLibraryID property. You must also state if it is a measure or a dimension in the qType property.

<qlik-visual appid="Helpdesk Management.qvf"
  type="gauge"
  cols='[
    {
      "qDef": {"qLibraryId": "eqZjE", "qType": "measure"}
    }
  ]'>
</qlik-visual>

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?