<?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: Mashup APIs - add button to set variable using setContent Method in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109493#M5016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The setContent() method was deprecated with Qlik Sense 2.1, you may want to use the setStringValue() method instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A super simple example with jQuery, which is loaded with the mashup api, might look something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTML&lt;/P&gt;&lt;P&gt;&amp;lt;input id="input-val"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;button id="submit-button"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Submit&lt;/P&gt;&lt;P&gt;&amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JS&lt;/P&gt;&lt;P&gt;$("#submit-button").click(function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; app.variable.setStringValue("MYVAR", $("#input-val").val());&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where "MYVAR" is the name of your qlik sense variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jun 2016 15:20:13 GMT</pubDate>
    <dc:creator>Francis_Kabinoff</dc:creator>
    <dc:date>2016-06-14T15:20:13Z</dc:date>
    <item>
      <title>Mashup APIs - add button to set variable using setContent Method</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109492#M5015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a qlik sense mashup html which is up and running.&amp;nbsp; I want to be able to change variables I have in my script through a web interface.&amp;nbsp; Ideallly, I want to create an input box and button into my mashup which will update a variable in qlik sense.&amp;nbsp; I've seen code examples in existing mashups on using the setContent Method, but not quite sure how to have that interact with an input box and button combination.&amp;nbsp; Does anyone have an example of this already working?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 11:41:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109492#M5015</guid>
      <dc:creator>pnowicki</dc:creator>
      <dc:date>2016-06-14T11:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Mashup APIs - add button to set variable using setContent Method</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109493#M5016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The setContent() method was deprecated with Qlik Sense 2.1, you may want to use the setStringValue() method instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A super simple example with jQuery, which is loaded with the mashup api, might look something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTML&lt;/P&gt;&lt;P&gt;&amp;lt;input id="input-val"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;button id="submit-button"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Submit&lt;/P&gt;&lt;P&gt;&amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JS&lt;/P&gt;&lt;P&gt;$("#submit-button").click(function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; app.variable.setStringValue("MYVAR", $("#input-val").val());&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where "MYVAR" is the name of your qlik sense variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 15:20:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109493#M5016</guid>
      <dc:creator>Francis_Kabinoff</dc:creator>
      <dc:date>2016-06-14T15:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Mashup APIs - add button to set variable using setContent Method</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109494#M5017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, this is helpful but not able to get it to work.&amp;nbsp; It all seems very straight forward but when I click the submit button nothing seems to happen.&amp;nbsp; I've tried both setStringValue and setContent.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an object that just displays the variable value and I'll know it is working when the submit button takes the value from the input box and updates the variable value in that object.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What else could be missing?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my HTML:&lt;/P&gt;&lt;P&gt;&amp;lt;input id="input-val"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;lt;button id="submit-button"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Submit&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my JS file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; $("#submit-button").click(function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; app.variable.setContent("wToday", $("#input-val").val());&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 13:26:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109494#M5017</guid>
      <dc:creator>pnowicki</dc:creator>
      <dc:date>2016-06-15T13:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Mashup APIs - add button to set variable using setContent Method</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109495#M5018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I figured out what I was doing wrong.&amp;nbsp; In my JS file, I needed to have this in the same section as my app.getObject calls are made, before I included this in a separate function section which didn't work since it couldn't recognize the app.&amp;nbsp; I was able to troubleshoot using the inspect feature of google chrome, which really helped debug it.&amp;nbsp; Thanks Francis for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$('#submit-button').on('click', function() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var app = qlik.openApp('App_ID', config);&lt;/P&gt;&lt;P&gt;&amp;nbsp; app.variable.setContent('wToday', $("#input-val").val());&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 14:51:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109495#M5018</guid>
      <dc:creator>pnowicki</dc:creator>
      <dc:date>2016-06-15T14:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Mashup APIs - add button to set variable using setContent Method</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109496#M5019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome! I was just writing a reply with some instructions on checking this out in the dev tools, but seems you found your way, nice!&amp;nbsp; Yep, any reference to 'app' will have to be in the same "scope" where 'app' is defined.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:26:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Mashup-APIs-add-button-to-set-variable-using-setContent-Method/m-p/1109496#M5019</guid>
      <dc:creator>Francis_Kabinoff</dc:creator>
      <dc:date>2016-06-15T15:26:11Z</dc:date>
    </item>
  </channel>
</rss>

