3 Replies Latest reply: Apr 2, 2016 1:09 PM by Eleni Theodoridou RSS

    Measure creation via javascript

    Eleni Theodoridou

      Hello,

       

      The case that I'm trying, is to create a measure on the fly and then get the value and add it to my html.

       

      I'm trying to create a measure via javascript, using qsocks.

      I used Engine api explorer to create the json message.

       

      {

        "handle": 1,

        "method": "CreateMeasure",

        "params": {

        "qProp": {

        "qInfo": {

        "qId": "SumQuantityId",

        "qType": "Measure"

        },

        "qMeasure": {

        "qLabel": "SumQuantity",

        "qDef": "=sum(Quantity)",

        "qGrouping": 0,

        "qExpressions": [

        ""

        ],

        "qActiveExpression": 0

        },

        "qMetaDef": {}

        }

        },

        "id": 6,

        "jsonrpc": "2.0"

        }

       

      This seems to work fine using the explorer.

       

      When i use qsocks, I get "error: {"code":9,"parameter":"Missing Type","message":"Empty parameters"}".

      .....

      qapp.createMeasure(obj).then(function(reply) { 

        console.log("reply: " + JSON.stringify(reply)); 

      }, function(error) {  

        console.log("error: " + JSON.stringify(error));

      });

      .....

       

      Of course, I'm connected to my app, and the "obj" is the json message provided above.

       

      Can someone help me?

       

      Thanks in advance,

      Eleni