3 Replies Latest reply: May 23, 2016 1:44 PM by Karl Fredberg RSS

    How to add library measures to table visualisation on the fly?

    Karl Fredberg

      I am experimenting with mash ups and trying out the visualisation on the fly. When I try to create a table with a library measure I can't get it to work. It works with library dimensions but not with library measures.

       

      table properties ‒ Qlik Sense

      The example in the help gives a columns array as option, but the properites above lists a qHyperCubeDef.

       

      This work

      app.visualization.create( 'table', [ "Case Owner Group", 
                { "qDef" : { "qDef" : "Avg([Case Duration Time])", 
                     "qLabel" : "Avg Case Duration Time" }, }, 
                { "qDef" : { "qDef" : "Sum( [Open Cases] )", 
                     "qLabel" : "Open Cases" } } ], 
      {"title" : "Case Owner Group Case stats"} ).then( function ( visual ) { visual.show( 'QV01' ); } );
      
      

       

      This doesn't work

      app.visualization.create( 'table', 
      [
        {qDef: {qFieldDefs: ["Employee Status"], "qFieldLabels":["Status"]},
        qNullSuppression: true},
        {
      
           "qLibraryId": "vpjnFZ",
           "qDef": {
               "qTags": [],
               "qGrouping": "N",
               "qNumFormat": {
                   "qType": "U",
                   "qnDec": 10,
                   "qUseThou": 0
               },
               "qAggrFunc": "Expr",
               "qAccumulate": 0,
               "qActiveExpression": 0,
               "qExpressions": [],
               "autoSort": true,
               "cId": "wfNgj",
               "numFormatFromTemplate": true,
               "textAlign": {
                   "auto": true,
                   "align": "left"
               }
           },
           "qSortBy": {
               "qSortByNumeric": -1,
               "qSortByLoadOrder": 1,
               "qExpression": {}
           },
           "qAttributeExpressions": [
               {},
               {}
           ],
           "qCalcCond": {}
      
        }
        ]
      , 
      {"title" : "Case Owner Group Case stats"} ).then( function ( visual ) { visual.show( 'QV01' ); } );
      
      

       

      Any ideas?