Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
subash29
Contributor III
Contributor III

From Table API in Qlik Sense how to get the Dimension Value or HTML Row

I tried with this funtion

var table = qlik.table(model);

var colNumber = table.getColByName('cedant_parent_name');

var rowCount = table.rowCount;

var cellvalue= table.row[0].dimensions[0].qText;

11 Replies
_jespers_
Partner - Creator II
Partner - Creator II

You either need to use a listener to be able to fetch the row counts:

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

Or you can do it like this:

var rows = table.qHyperCube.qSize.qcy;

var cols = table.qHyperCube.qSize.qcx;

Regarding dimension value, that's depending on how many dimensions you have added and on which row you want to fetch the value.

This is an example on how to loop through all your data:

var data = table.qHyperCube.qDataPages[0].qMatrix;

                $.each(data, function( key, value ) {

                      console.log("value", value);

                });

subash29
Contributor III
Contributor III
Author

Thank you for the reply i can able to get the row count using

var rowCount = table.rowCount;


but i want the particular dimension column values or  the binded html to bind the my custom functions;

I dont know how the listener help to get the data?

_jespers_
Partner - Creator II
Partner - Creator II

If you look at my example where I loop through the data.

The variable "value" will contain all the different dimension & measure values for the current row, or is this not what you are after?

subash29
Contributor III
Contributor III
Author

Hi jesper,

When i tried to add the below variable from table is affecting my js

var data = table.qHyperCube.qDataPages[0].qMatrix;

_jespers_
Partner - Creator II
Partner - Creator II

Hi,

Have you added this to your .js-file:

initialProperties : {

                qHyperCubeDef : {

                    qDimensions : [],

                    qMeasures : [],

                    qInitialDataFetch : [{

                        qWidth : 10,

                        qHeight : 50

                    }]

                }

            },

subash29
Contributor III
Contributor III
Author

I am new to this hypercubles

i didn't created any  hypercubes yet i dont know where to add this in my js files ?

subash29
Contributor III
Contributor III
Author

scipt.PNG

ErikWetterberg

What do you want to do? The table API helps you work with the data from the hypercube, it does not help you with HTML rows or any other HTML. For that you need standard JavaScript possibly with the help of some library like jQuery, which is included with Qlik Sense.

Hope this helps

Erik Wetterberg

subash29
Contributor III
Contributor III
Author

i have to create the simple table with dimensions,measure and total,avg v values for measure will show on ranking order of measure values.