Get Object Data

by Alexander Karlsson

HTML

<script src="https://branch.qlik.com/anon/resources/assets/external/requirejs/require.js"></script>
<link rel="stylesheet" href="https://branch.qlik.com/anon/resources/autogenerated/qlik-styles.css">
<div id="chart"></div>

CSS

#chart {
  white-space: pre;
  height: 100%;
  width: 100%;
}

.qv-object-applayout {
  overflow: scroll;
}

JavaScript

var config = {
  host: 'branch.qlik.com',
  isSecure: true,
  prefix: '/anon/'
}
var qBase = 'https://branch.qlik.com/anon/resources';

require.config({
  paths: {
    'qlik': 'https://branch.qlik.com/anon/resources/js/qlik'
  },
  baseUrl: qBase
});
require(['js/qlik'], function(qlik) {
	
    const app = qlik.openApp('d7b1f94e-749b-479a-9bad-fcb8fccda5dc', config);
     
    app.getObject("rJFbvG").then(model => {
      // Contains the full size of the hypercube, qcx which is the width
      // or number of columns and qcy the height or number or rows
      console.log(model.layout.qHyperCube.qSize);
    
      // Fetch a page of data. A single page can maximum contain 10000
      // cells. Calculate the page size and number of pages based of qSize
      // and fetch accordingly.
      model.getHyperCubeData('/qHyperCubeDef', [{
        qTop: 0, 
        qLeft: 0, 
        qWidth: 10, 
        qHeight: 1000
      }]).then(data => console.log(data))
    })
    

        
});