forked from qlik-oss/enigma.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfield-list.js
39 lines (35 loc) · 971 Bytes
/
field-list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const createSession = require('../../session');
const script = `
TempTable:
Load
RecNo() as Field1,
Rand() as Field2,
Rand() as Field3
AutoGenerate 100
`;
const properties = {
qInfo: {
qType: 'my-field-list',
},
qFieldListDef: {},
};
const session = createSession();
// Open the session and create a session document:
session
.open()
.then(global => global.createSessionApp())
.then(doc =>
// Load in some data into the session document:
doc.setScript(script)
.then(() => doc.doReload())
.then(() =>
// Create a field list using qFieldListDef and list all fields available in the document.
doc
.createObject(properties)
.then(object => object.getLayout())
.then(layout => console.log('Field list:', JSON.stringify(layout, null, ' ')))
.then(() => session.close())))
.catch((error) => {
console.log('Session: Failed to open socket:', error);
process.exit(1);
});