<?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 SELECT is activated once in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SELECT-is-activated-once/m-p/149848#M27967</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to loop through Areas, Branches and their values, but it seems the select statement is activated only once, and afterwards the selected value remains the same, even after using the clear method.&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;thnx in advance.&lt;/P&gt;&lt;P&gt;sub calculateAreasGoals&lt;BR /&gt; dim a(5)&lt;BR /&gt; Set val=ActiveDocument.Fields("Areas").GetPossibleValues&lt;BR /&gt; 'ActiveDocument.ClearAll False&lt;BR /&gt; For i=0 to val.Count-1&lt;BR /&gt; ActiveDocument.Fields("Areas").Select val.Item(i).Text&lt;BR /&gt; a(i) = loopBranches&lt;BR /&gt; 'Activedocument.ClearAll&lt;BR /&gt; next 'i&lt;BR /&gt; set val=nothing&lt;BR /&gt; Activedocument.Fields("Areas").Clear&lt;BR /&gt; ActiveDocument.ClearAll False&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;function getGoal()&lt;BR /&gt; set val_1 = nothing&lt;BR /&gt; Activedocument.Fields("NISGOAL").clear&lt;BR /&gt; Set val_1=ActiveDocument.Fields("NISGOAL").GetPossibleValues&lt;BR /&gt; ActiveDocument.Fields("NISGOAL").Select val_1.Item(0).Text&lt;BR /&gt; Activedocument.Fields("NISGOAL").Unlock&lt;BR /&gt; Activedocument.Fields("NISGOAL").Clear&lt;BR /&gt; tmp = val_1.Item(0).Text&lt;BR /&gt; set val_1 = nothing&lt;BR /&gt; getGoal = tmp&lt;BR /&gt;end function&lt;/P&gt;&lt;P&gt;function loopBranches&lt;BR /&gt; Set branch=ActiveDocument.Fields("BRANCHNAME").GetPossibleValues&lt;BR /&gt; Accumulator=0&lt;BR /&gt; for i = 0 to branch.Count-1&lt;BR /&gt; set vals=nothing&lt;BR /&gt; tmp = branch.Item(i).Text&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Unlock&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Select branch.Item(i).Text&lt;BR /&gt; set vals=ActiveDocument.Fields("BRANCHNAME").GetSelectedValues&lt;BR /&gt; Accumulator=Accumulator+getGoal&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; next 'i&lt;BR /&gt; set branch=nothing&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Unlock&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; loopBranches = Accumulator&lt;BR /&gt;end function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jul 2009 18:56:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-21T18:56:24Z</dc:date>
    <item>
      <title>SELECT is activated once</title>
      <link>https://community.qlik.com/t5/QlikView/SELECT-is-activated-once/m-p/149848#M27967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to loop through Areas, Branches and their values, but it seems the select statement is activated only once, and afterwards the selected value remains the same, even after using the clear method.&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;thnx in advance.&lt;/P&gt;&lt;P&gt;sub calculateAreasGoals&lt;BR /&gt; dim a(5)&lt;BR /&gt; Set val=ActiveDocument.Fields("Areas").GetPossibleValues&lt;BR /&gt; 'ActiveDocument.ClearAll False&lt;BR /&gt; For i=0 to val.Count-1&lt;BR /&gt; ActiveDocument.Fields("Areas").Select val.Item(i).Text&lt;BR /&gt; a(i) = loopBranches&lt;BR /&gt; 'Activedocument.ClearAll&lt;BR /&gt; next 'i&lt;BR /&gt; set val=nothing&lt;BR /&gt; Activedocument.Fields("Areas").Clear&lt;BR /&gt; ActiveDocument.ClearAll False&lt;BR /&gt;end sub&lt;/P&gt;&lt;P&gt;function getGoal()&lt;BR /&gt; set val_1 = nothing&lt;BR /&gt; Activedocument.Fields("NISGOAL").clear&lt;BR /&gt; Set val_1=ActiveDocument.Fields("NISGOAL").GetPossibleValues&lt;BR /&gt; ActiveDocument.Fields("NISGOAL").Select val_1.Item(0).Text&lt;BR /&gt; Activedocument.Fields("NISGOAL").Unlock&lt;BR /&gt; Activedocument.Fields("NISGOAL").Clear&lt;BR /&gt; tmp = val_1.Item(0).Text&lt;BR /&gt; set val_1 = nothing&lt;BR /&gt; getGoal = tmp&lt;BR /&gt;end function&lt;/P&gt;&lt;P&gt;function loopBranches&lt;BR /&gt; Set branch=ActiveDocument.Fields("BRANCHNAME").GetPossibleValues&lt;BR /&gt; Accumulator=0&lt;BR /&gt; for i = 0 to branch.Count-1&lt;BR /&gt; set vals=nothing&lt;BR /&gt; tmp = branch.Item(i).Text&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Unlock&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Select branch.Item(i).Text&lt;BR /&gt; set vals=ActiveDocument.Fields("BRANCHNAME").GetSelectedValues&lt;BR /&gt; Accumulator=Accumulator+getGoal&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; next 'i&lt;BR /&gt; set branch=nothing&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Unlock&lt;BR /&gt; ActiveDocument.Fields("BRANCHNAME").Clear&lt;BR /&gt; loopBranches = Accumulator&lt;BR /&gt;end function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 18:56:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SELECT-is-activated-once/m-p/149848#M27967</guid>
      <dc:creator />
      <dc:date>2009-07-21T18:56:24Z</dc:date>
    </item>
  </channel>
</rss>

