<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Measure creation via javascript in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076607#M4729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot both of you for your quick replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14596168160277512" jivemacro_uid="_14596168160277512" modifiedtitle="true"&gt;
&lt;P&gt;app.evaluate("=sum(Quantity)").then(function ( reply ) {&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;}, function(error) {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but it sums all "quantity", instead of selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Apr 2016 17:09:47 GMT</pubDate>
    <dc:creator>eleni_theodorid</dc:creator>
    <dc:date>2016-04-02T17:09:47Z</dc:date>
    <item>
      <title>Measure creation via javascript</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076604#M4726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to create a measure via javascript, using qsocks.&lt;/P&gt;&lt;P&gt;I used Engine api explorer to create the json message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; "handle": 1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; "method": "CreateMeasure",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "params": {&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qProp": {&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qInfo": {&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qId": "SumQuantityId",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qType": "Measure"&lt;/P&gt;&lt;P&gt;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qMeasure": {&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qLabel": "SumQuantity",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qDef": "=sum(Quantity)",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qGrouping": 0,&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qExpressions": [&lt;/P&gt;&lt;P&gt;&amp;nbsp; ""&lt;/P&gt;&lt;P&gt;&amp;nbsp; ],&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qActiveExpression": 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp; "qMetaDef": {}&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp; "id": 6,&lt;/P&gt;&lt;P&gt;&amp;nbsp; "jsonrpc": "2.0"&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems to work fine using the explorer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i use qsocks, I get "error: {"code":9,"parameter":"Missing Type","message":"Empty parameters"}".&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;qapp.createMeasure(obj).then(function(reply) {&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("reply: " + JSON.stringify(reply));&amp;nbsp; &lt;/P&gt;&lt;P&gt;}, function(error) {&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; console.log("error: " + JSON.stringify(error));&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, I'm connected to my app, and the "obj" is the json message provided above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Eleni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Mar 2016 11:52:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076604#M4726</guid>
      <dc:creator>eleni_theodorid</dc:creator>
      <dc:date>2016-03-27T11:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measure creation via javascript</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076605#M4727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just want to evaluate the expression, then you might want to look into this engine API method: &lt;A href="http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/EngineAPI/Content/Classes/AppClass/App-class-Evaluate-method.htm" title="http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/EngineAPI/Content/Classes/AppClass/App-class-Evaluate-method.htm"&gt;Evaluate method ‒ Qlik Sense&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if that method is available in through the API you are using though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 09:41:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076605#M4727</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2016-03-29T09:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Measure creation via javascript</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076606#M4728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't really want to create a measure, but only get the expression evaluated, you could use the Capability APIs and the&lt;A href="http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/APIs/Content/MashupAPI/Methods/createGenericObject-method.htm"&gt; createGenericObject &lt;/A&gt;method. For your expression that would be something like this:&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1459246399066520 jive_text_macro" jivemacro_uid="_1459246399066520" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;app&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function" style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;createGenericObject&lt;SPAN class="token punctuation" style="color: #999999;"&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sumQuantity&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; qValueExpression&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token string" style="color: #b22222; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=sum(Quantity)&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token keyword" style="color: blue; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; reply &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;//handle the reply&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;//the value will be in reply.sumQuantity&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;//and this function will be called whenever the value changes&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation" style="color: #999999; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 12px; background-color: #fafafa;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 10:17:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076606#M4728</guid>
      <dc:creator>ErikWetterberg</dc:creator>
      <dc:date>2016-03-29T10:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Measure creation via javascript</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076607#M4729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot both of you for your quick replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14596168160277512" jivemacro_uid="_14596168160277512" modifiedtitle="true"&gt;
&lt;P&gt;app.evaluate("=sum(Quantity)").then(function ( reply ) {&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;}, function(error) {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but it sums all "quantity", instead of selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Apr 2016 17:09:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Measure-creation-via-javascript/m-p/1076607#M4729</guid>
      <dc:creator>eleni_theodorid</dc:creator>
      <dc:date>2016-04-02T17:09:47Z</dc:date>
    </item>
  </channel>
</rss>

