How to Create Measure Using Hypercube In Qliksnese Mashup

        Hi to All. Now I am going to Share how to use hypercube in Qliksense Mashup.

    Suppose we want show one measure in mashup, Now no need to take Qliksense Text object. Direct We can create measure in Mashup By Using Hypercubes.

     

    Step1:-

     

    Go to Devhub--> Click On Create New Mashup --> open Mashup

     

    Side we able to see Lists And Hyper Cubes Option

     

    Hyper1.JPG

    Click On Add Hypercube --> Click On Measure --> In measure Write whichever expr required after give some name in callback function for reference.

    like:-

    Hyper2.JPG

     

    Now automatically Code will generate in js file like

     

    app.createCube({

    "qInitialDataFetch": [

    {

    "qHeight": 20,

    "qWidth": 1

    }

    ],

    "qDimensions": [],

    "qMeasures": [

    {

    "qDef": {

    "qDef": "=sum(Sales)"  --> Here we can write expt

    },

    "qLabel": "=sum(Sales)",  --> Here We can write label

    "qLibraryId": null,

    "qSortBy": {

    "qSortByState": 0,

    "qSortByFrequency": 0,

    "qSortByNumeric": 0,

    "qSortByAscii": 1,

    "qSortByLoadOrder": 0,

    "qSortByExpression": 0,

    "qExpression": {

    "qv": " "

    }

    }

    }

    ],

    "qSuppressZero": false,

    "qSuppressMissing": false,

    "qMode": "S",

    "qInterColumnSortOrder": [],

    "qStateName": "$"

    },Sales);

    function Sales(reply, app){

    }

     

    Step2:- Now we need to create call back function code inside

    function Sales(reply, app){

    ------here need to write code---

    }

     

    step3:-

    var output = reply.qHyperCube.qDataPages[0].qMatrix[0][0].qText;

      $("#gross1").text(output);

     

    write this condion on inside function

     

    Finally we get code like:-

     

    app.createCube({

    "qInitialDataFetch": [

    {

    "qHeight": 20,

    "qWidth": 1

    }

    ],

    "qDimensions": [],

    "qMeasures": [

    {

    "qDef": {

    "qDef": "=sum(Sales)"  --> Here we can write expt

    },

    "qLabel": "=sum(Sales)",  --> Here We can write label

    "qLibraryId": null,

    "qSortBy": {

    "qSortByState": 0,

    "qSortByFrequency": 0,

    "qSortByNumeric": 0,

    "qSortByAscii": 1,

    "qSortByLoadOrder": 0,

    "qSortByExpression": 0,

    "qExpression": {

    "qv": " "

    }

    }

    }

    ],

    "qSuppressZero": false,

    "qSuppressMissing": false,

    "qMode": "S",

    "qInterColumnSortOrder": [],

    "qStateName": "$"

    },Sales);

    function Sales(reply, app)

    {

    var output = reply.qHyperCube.qDataPages[0].qMatrix[0][0].qText;

      $("#gross1").text(output);

    }


    Step4:-

      Now we need to call this #gross1 function in Html

    Like,

    <div class="col-xs-12 col-sm-12 col-md-3">

         <div id="gross1"></div>

    </div>

     

    Finally we will get output like in URL:-

    Measure1.JPG

     

    Thanks & Regards,

    Lakshmipathi P,