Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
erwanallain
Partner - Contributor II
Partner - Contributor II

Get the data from another table object

Hello, I develop an extension qlik sense and I'm stuck in a point.

I want to get all data from a table, so i use an ID ( v.selectedtableObject )  to get the object:

qlik.currApp.getObject(v.selectedTableObject).then(function(model){

Then i get the title of dimension and measure:

//Dim
model.layout.qHyperCube.qDimensionInfo.forEach( function(value, col) {//Dim
	tableHTML += value.qFallbackTitle;
});
			
//Mea
model.layout.qHyperCube.qMeasureInfo.forEach( function(value, col) {//Mea
	tableHTML += value.qFallbackTitle ;
});

Then i get the total value:

//Total
model.layout.qHyperCube.qGrandTotalRow.forEach( function(value, col) {//total
	tableHTML += value.qText ;
});

And now i want to get the data (dimension and measure) values, normally it's here:

model.layout.qHyperCube.qDataPages[0].qMatrix

but qDataPages is empty...

Maybe the data was not here...

Some one can help me ? Smiley Happy

Labels (2)
1 Solution

Accepted Solutions
erwanallain
Partner - Contributor II
Partner - Contributor II
Author

Ok i finded a solution, for get the data i need to call this function (getHyperCubeData).

Here i get 8 column and 100 line. (but we can get the 10,000 values of the hypercube).

So i call the getHyperCubeData function, then I initialize the dataPage,

-> then I go in the 1st dimension of my data variable (it's the dataPage),

-> then i browse the 1st dimension of the qMatrix array (it's the line),

-> then i browse the 2nd dimension of the qMatrix array (it's the column),

-> and then I add to my variable the value of the cell (row.qText)

 

model.getHyperCubeData('/qHyperCubeDef', [{
	qLeft: 0,
	qTop: 0,
	qWidth: 8,
	qHeight: 100
}]).then( function ( data ) {
		//Dim
		data[0].qMatrix.forEach( function(rows) {//1D
			rows.forEach( function(row) {//2D
				tableHTML += row.qText;
				});//End of 2D
		});//End of 1D
	});//End of getHyperCubeData

 

View solution in original post

1 Reply
erwanallain
Partner - Contributor II
Partner - Contributor II
Author

Ok i finded a solution, for get the data i need to call this function (getHyperCubeData).

Here i get 8 column and 100 line. (but we can get the 10,000 values of the hypercube).

So i call the getHyperCubeData function, then I initialize the dataPage,

-> then I go in the 1st dimension of my data variable (it's the dataPage),

-> then i browse the 1st dimension of the qMatrix array (it's the line),

-> then i browse the 2nd dimension of the qMatrix array (it's the column),

-> and then I add to my variable the value of the cell (row.qText)

 

model.getHyperCubeData('/qHyperCubeDef', [{
	qLeft: 0,
	qTop: 0,
	qWidth: 8,
	qHeight: 100
}]).then( function ( data ) {
		//Dim
		data[0].qMatrix.forEach( function(rows) {//1D
			rows.forEach( function(row) {//2D
				tableHTML += row.qText;
				});//End of 2D
		});//End of 1D
	});//End of getHyperCubeData