<?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 Why does &amp;quot;Field.ToggleSelect&amp;quot; work when &amp;quot;Field.SelectValues&amp;quot; fails? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160672#M503873</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're setting both values to the same array spot. You're overwritting the first value with the second value. Also, they set the IsNumeric properties of the array elements. Try this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = "20.5"&lt;BR /&gt;fieldValues(0).IsNumeric = false&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(1).Text = "20.6"&lt;BR /&gt;fieldValues(1).IsNumeric = false&lt;BR /&gt;&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You're using text values for your field in your example, but they look like numbers. You may want to try this as well:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = 20.5&lt;BR /&gt;fieldValues(0).IsNumeric = true&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(1).Text = 20.6&lt;BR /&gt;fieldValues(1).IsNumeric = true&lt;BR /&gt;&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 21 Nov 2009 00:07:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-11-21T00:07:10Z</dc:date>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160671#M503872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some very simple data and code (culled from a larger application) where I'm trying to select multiple values of a field in a macro.&lt;/P&gt;&lt;P&gt;Here's the sample version:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; release, revisions&lt;BR /&gt; 20.5, 140&lt;BR /&gt; 20.6, 132&lt;BR /&gt; 20.7, 129&lt;BR /&gt; 20.8, 145&lt;BR /&gt;];&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and two code snippets:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;rem Using SelectValues, doesn't work&lt;BR /&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = "20.5"&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = "20.6"&lt;BR /&gt;&lt;BR /&gt;releaseField.SelectValues(fieldValues)&lt;BR /&gt;rem Using ToggleSelect *does* work&lt;BR /&gt;ActiveDocument.Fields("release").Select("20.5")&lt;BR /&gt;ActiveDocument.Fields("release").ToggleSelect("20.6")&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;ToggleSelect works to allow me to select multiple values of the field, but the seemingly more flexible and powerful SelectValues fails (returns false).&lt;/P&gt;&lt;P&gt;What subtlety about SelectValues am I missing? In other words, why is SelectValues failing?&lt;/P&gt;&lt;P&gt;This is using v8.5.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 00:00:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160671#M503872</guid>
      <dc:creator />
      <dc:date>2009-11-21T00:00:40Z</dc:date>
    </item>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160672#M503873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're setting both values to the same array spot. You're overwritting the first value with the second value. Also, they set the IsNumeric properties of the array elements. Try this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = "20.5"&lt;BR /&gt;fieldValues(0).IsNumeric = false&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(1).Text = "20.6"&lt;BR /&gt;fieldValues(1).IsNumeric = false&lt;BR /&gt;&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You're using text values for your field in your example, but they look like numbers. You may want to try this as well:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = 20.5&lt;BR /&gt;fieldValues(0).IsNumeric = true&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(1).Text = 20.6&lt;BR /&gt;fieldValues(1).IsNumeric = true&lt;BR /&gt;&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 00:07:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160672#M503873</guid>
      <dc:creator />
      <dc:date>2009-11-21T00:07:10Z</dc:date>
    </item>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160673#M503874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, the overwriting of values came from copying and pasting my code (always a mistake &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;)&lt;/P&gt;&lt;P&gt;I tried what you suggested, but that doesn't work either. I get the feeling that there's something else I need to do to the field first, but I can't see an obvious method, or property to set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 00:20:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160673#M503874</guid>
      <dc:creator />
      <dc:date>2009-11-21T00:20:08Z</dc:date>
    </item>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160674#M503875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EDIT: See below...&lt;/P&gt;&lt;P&gt;I've attached a doc with similar data to yours. I could not get it to select numeric values. It selects text values just fine.&lt;/P&gt;&lt;P&gt;There were some changes I needed to make to the code I gave you above. Here's what works for selecting text:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sub Testing&lt;BR /&gt;set releaseField = ActiveDocument.Fields("letters")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Text = "AAA"&lt;BR /&gt;fieldValues(0).IsNumeric = false&lt;BR /&gt;fieldValues(1).Text = "BBB"&lt;BR /&gt;fieldValues(1).IsNumeric = false&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;BR /&gt;End Sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 01:17:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160674#M503875</guid>
      <dc:creator />
      <dc:date>2009-11-21T01:17:07Z</dc:date>
    </item>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160675#M503876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a duplicate, sorry for the triple post (it's Friday &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 01:21:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160675#M503876</guid>
      <dc:creator />
      <dc:date>2009-11-21T01:21:31Z</dc:date>
    </item>
    <item>
      <title>Why does "Field.ToggleSelect" work when "Field.SelectValues" fails?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160676#M503877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, I figured it out, you need to use .Number not .Text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sub TestingNum&lt;BR /&gt;set releaseField = ActiveDocument.Fields("release")&lt;BR /&gt;set fieldValues = releaseField.GetNoValues&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues.Add&lt;BR /&gt;fieldValues(0).Number = 20.5&lt;BR /&gt;fieldValues(0).IsNumeric = true&lt;BR /&gt;fieldValues(1).Number = 20.6&lt;BR /&gt;fieldValues(1).IsNumeric = true&lt;BR /&gt;releaseField.SelectValues fieldValues&lt;BR /&gt;End Sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Nov 2009 01:21:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-quot-Field-ToggleSelect-quot-work-when-quot-Field/m-p/160676#M503877</guid>
      <dc:creator />
      <dc:date>2009-11-21T01:21:59Z</dc:date>
    </item>
  </channel>
</rss>

