Skip to main content

createCube method

ON THIS PAGE

createCube method

Note: STABLE.

This API is reliable and breaking changes are unlikely.

qlik.app.createCube(qHyperCubeDef, callback)

Defines a hypercube and registers a callback to receive the data.

Version history

Version history
Version state Details
Introduced 1.0

Parameters

qHyperCubeDef

Type: Object

Hypercube definition.

callback

Type: Function

Optional.

Callback method. Registers a callback that is executed every time data is returned.

Parameter will contain a qHyperCube.

Returns

A promise of an object model.

Tip: For more information regarding a promise, see The Promise API.

Example

app.createCube({
	qDimensions : [{
		qDef : {
			qFieldDefs : ["FirstName"]
		}
	}, {
		qDef : {
			qFieldDefs : ["LastName"]
		}
	}],
	qMeasures : [{
		qDef : {
			qDef : "1"
		}
	}],
	qInitialDataFetch : [{
		qTop : 0,
		qLeft : 0,
		qHeight : 20,
		qWidth : 3
	}]
}, function(reply) {
	var str = "";
	$.each(reply.qHyperCube.qDataPages[0].qMatrix, function(key, value) {
		str += '<li>' + value[0].qText + ':' + value[1].qText + '</li>';
	});
	$('#list').html(str);
	;
});

See also: