<?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: Understanding QField.selectValues() in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1652097#M11877</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Perhaps you should start by reading the docs:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/FieldAPI/selectValues-method.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/FieldAPI/selectValues-method.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Second parameter, which is set to true in all your examples is&amp;nbsp;&lt;SPAN&gt;toggle, which means that it will deselect an already selected value. If you don't want that set the parameter to false, or omit it, since false is the default.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Nov 2019 06:50:39 GMT</pubDate>
    <dc:creator>ErikWetterberg</dc:creator>
    <dc:date>2019-11-28T06:50:39Z</dc:date>
    <item>
      <title>Understanding QField.selectValues()</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1651909#M11870</link>
      <description>&lt;P&gt;I'm new to Qlik and it's been almost 10 years since I programmed in JavaScript, so please bear with me...I'm trying to make an extension.&lt;/P&gt;&lt;P&gt;I'm having several issues with QField.selectValues(). In the course of trying to diagnose my problem, I've encountered several things I'd like to have clarified.&lt;/P&gt;&lt;P&gt;A selectValues() call doesn't seem to be idempotent. If I make a call once, it works. If I make the same call twice in a row, nothing happens. Why? Logically, shouldn't it be idempotent? (I'm looking to understand why so I can integrate the rationale into my mental model.)&lt;/P&gt;&lt;P&gt;By way of example, consider the snippet below. If there was only one selectValues() below it works find. A second causes no selection to occur. A third causes it to be selected. Is selectValues() really a toggle of some sort? If so, why?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;$("#" + utils.fieldToId(curField)).on( "click", "#" + id, function() {
   thisApp.field("First Name").selectValues(["Brad"], true, true);
   thisApp.field("First Name").selectValues(["Brad"], true, true);
   thisApp.field("First Name").selectValues(["Brad"], true, true);
});​​&lt;/LI-CODE&gt;&lt;P&gt;When calling selectValues() there seems to be a difference between passing in a Qlik-generated row object with a qText property and a generic object with a qText property. Why? If I pass in a Qlik object it fails. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;thisApp.field(value.qName).rows.forEach( function(row) {
...
thisApp.field(curField.qName).selectValues([row], true, true); //does not work
thisApp.field(curField.qName).selectValues([{qText:row.qText}], true, true); //works​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code in my first example works. I see several questions where answers seems to indicate that my field name should have been "[First Name]" because it has a space in it. What are the rules around this? With out the square braces am I playing with fire? When programming for an unknown field name, is it programmatically best practice to always include the square braces? If so, isn't that something the API do that for us?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2019 14:08:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1651909#M11870</guid>
      <dc:creator>BradMazurek</dc:creator>
      <dc:date>2019-11-27T14:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding QField.selectValues()</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1652097#M11877</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Perhaps you should start by reading the docs:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/FieldAPI/selectValues-method.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/FieldAPI/selectValues-method.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Second parameter, which is set to true in all your examples is&amp;nbsp;&lt;SPAN&gt;toggle, which means that it will deselect an already selected value. If you don't want that set the parameter to false, or omit it, since false is the default.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 06:50:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1652097#M11877</guid>
      <dc:creator>ErikWetterberg</dc:creator>
      <dc:date>2019-11-28T06:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding QField.selectValues()</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1652372#M11884</link>
      <description>&lt;P&gt;Fair for the first point. I was deep enough in diagnosing other problems that I didn't return to the top level and reread the docs. Thank you.&lt;/P&gt;&lt;P&gt;I'll ask the other questions again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 14:22:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Understanding-QField-selectValues/m-p/1652372#M11884</guid>
      <dc:creator>BradMazurek</dc:creator>
      <dc:date>2019-11-28T14:22:45Z</dc:date>
    </item>
  </channel>
</rss>

