Last active
April 17, 2022 18:31
-
-
Save countnazgul/e1295073e04b301d8fd4933182193a44 to your computer and use it in GitHub Desktop.
[Create master visualisation item] #qlik #qliksense #enigma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The idea is to create a master item visualisation from | |
// an existing dashboard object | |
// If the requirement is to create a master item from json (exported from another app) | |
// the first step is to create the source object first and the use it | |
// to create the master item and then drop the source (if needed) | |
// Create empty object with type of masteritem | |
let myMasterItem = await qDoc.createObject({ | |
"qInfo": { | |
"qId": "my-id", | |
"qType": "masterobject" | |
}, | |
"qExtendsId": "", | |
"qMetaDef": {"tite": "", "description": "", "tags": []}, | |
"qStateName": "" | |
} | |
) | |
// Copy the properties from an existing object | |
await myMasterItem.copyFrom("my-source-object") | |
// Get the masteritem properties and update the meta definition | |
// setting the title and description | |
let myMasterItemProperties = await myMasterItem.getProperties() | |
myMasterItemProperties.qMetaDef = {title: "My Master Item", description: "Master Item created with Engine API", tags: []} | |
//Finally - update the master item properties with the changed mete def | |
await myMasterItem.setProperties(myMasterItemProperties) | |
// at this point is safe to drop the source object ... if required | |
// await qDoc.deleteObject("my-source-object") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment