Skip to content

Instantly share code, notes, and snippets.

@countnazgul
Last active April 17, 2022 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save countnazgul/e1295073e04b301d8fd4933182193a44 to your computer and use it in GitHub Desktop.
Save countnazgul/e1295073e04b301d8fd4933182193a44 to your computer and use it in GitHub Desktop.
[Create master visualisation item] #qlik #qliksense #enigma
// 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