Published
Edited
May 4, 2021
1 fork
Enigma.js - GetObject() with all data
Enigma.js - Simple Hypercube - Get All Data
Insert cell
md`# Enigma.js - GetObject() with all data`
Insert cell
element = html`<div></div>`
Insert cell
import { enigmaApp } from "@yianni-ververis/enigma-js"
Insert cell
{
const app = await enigmaApp;
const model = await app.getObject('rJFbvG'); // It's a table
const modelLayout = await model.getLayout();
const data = [];
const columns = modelLayout.qHyperCube.qSize.qcx;
const totalheight = modelLayout.qHyperCube.qSize.qcy;
// Replace pageheight & numberOfPages number with the comments to get all data
const pageheight = 5 // Math.floor(10000 / columns);
const numberOfPages = 3 // Math.ceil(totalheight / pageheight);
for (let i = 0; i < numberOfPages; i++) {
const page = {
qTop: pageheight * i,
qLeft: 0,
qWidth: columns,
qHeight: pageheight,
};
const row = await model.getHyperCubeData('/qHyperCubeDef', [page]);
data.push(...row[0].qMatrix);
}
const table = data.map(x => `<tr><td>${x[0].qText}</td><td>${x[1].qText}</td><td>${x[2].qText}</td></tr>`);
return html`
<table style="width:100%">
<tr>
<th>Department</th>
<th>Priority</th>
<th>Avg Duration</th>
</tr>
${table}
</table>
`
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more