Table API

STABLE.
This API is reliable and breaking changes are unlikely.

qlik.table

The Table API allow developers to work with tabular data returned from the Qlik Associative Engine without having deeper knowledge of internal constructs, like for example a Hypercube.

Version history

Introduced 2.1

Getting started

The qlik.app.createTable method is the entry point to the Table API. It creates a table object that wraps the hypercube. A table object of type QTable is returned. It is initially empty but will eventually contain data. The table object will be updated when selection state changes. Notification is sent when data is available and will be triggered after each update. To receive notification bind a listener on OnData of QTable instance.

createTable method

Initialization using the hypercube of the current visualization

	 var table = qlik.table( this );

	 var listener = function() {
		var rowCount = table.rowCount;
		var colCount = table.colCount;
		table.OnData.unbind( listener );  //unregister the listener when no longer notification is needed.
	 };
	 table.OnData.bind( listener ); //bind the listener
Your main script, based on using AngularJS.

	if ( !this.$scope.table ) {
	this.$scope.table = qlik.table( this );
	}
In your AngularJS template
	<tr ng-repeat="row in table.rows">
        	<td ng-repeat="cell in row.cells"> {{cell.qText}} </td>;
        </tr>

Version history

Each method and property contain information around when it was introduced, updated, deprecated or removed. A list of all relevant API changes per version release can be found in API version history.

Examples of use

Learn what you can do with the Table API.

Export the hypercube

Example 1:  

This example creates a button that exports the entire hypercube data when pressed.

var qTable = qlik.table(this);

var $exportButton = $( document.createElement('button'));
$exportButton.html('Export');
$exportButton.bind('click', function (  ) {
			qTable.exportData({download: true});
		});
$element.append($exportButton);

Example 2:  

This example is using AngularJS in a visualization extension

Main script:
...
paint: function ( ) {
  //setup scope.table
  if ( !this.$scope.table ) {
    this.$scope.table = qlik.table( this );
  }
}
...
Angular template:
<button ng-click="table.exportData({download:true})">Create Excel file</button>

Get more hypercube data

This example gets more data for your hypercube and is based on using AngularJS in a visualization extension.

Main script:
...
paint: function ( ) {
  //setup scope.table
  if ( !this.$scope.table ) {
    this.$scope.table = qlik.table( this );
  }
}
...
Angular template:
<button ng-if="data.rowcount>data.rows.length" ng-click="data.getMoreData()">More</button>

Did this information help you?

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

Thanks for helping us improve!