<?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: DO WHILE Loop thorugh Hierarchy in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399598#M613252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15041234846483899 jive_text_macro" jivemacro_uid="_15041234846483899"&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Do while vDepth &amp;gt; 0&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; LET vDepth = vDepth - 1;&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Loop;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;with initial Depth max value you might as well use a For ... Next loop with &lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptControlStatements/For%20Each.htm" title="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptControlStatements/For%20Each.htm"&gt;FieldValueList&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15041234799816949" jivemacro_uid="_15041234799816949"&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;FOR Each &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vDepth &lt;/SPAN&gt; in FieldValueList('Depth')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt; NEXT &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vDepth&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;hope this helps&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;regards&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Aug 2017 20:04:55 GMT</pubDate>
    <dc:creator>MarcoWedel</dc:creator>
    <dc:date>2017-08-30T20:04:55Z</dc:date>
    <item>
      <title>DO WHILE Loop thorugh Hierarchy</title>
      <link>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399596#M613250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Qlik Community!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We get a csv file each month with the current organizational structur. I load all those files into qlikview and generate a hierarchy. So far so good. Now i'd like to generate one table for each depth / level. Currently there are 4 ( 1 - 4) levels. I could just say WHERE LEVEL =1 and so on. But the problem is, that the depth can change (levels can be added or removed). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I got the Loop part:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QUALIFY * ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDepth = 4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do while vDepth &amp;gt; 0&lt;/P&gt;&lt;P&gt;LET vTableName = 'Level' &amp;amp; $(vDepth);&lt;/P&gt;&lt;P&gt;$(vTableName):&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;OrgHierarchyTmp&lt;/P&gt;&lt;P&gt;WHERE Depth = $(vDepth);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDepth = vDepth - 1;&lt;/P&gt;&lt;P&gt;Loop;&lt;/P&gt;&lt;P&gt;This is working.&lt;/P&gt;&lt;P&gt;The only problem left: If I try to assign the vDepth dynamically like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDepth = 'max(Depth)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SET vDepth = 'max(Depth)'; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;is not working neither.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Any ideas?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; best Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 09:39:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399596#M613250</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-29T09:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: DO WHILE Loop thorugh Hierarchy</title>
      <link>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399597#M613251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use Peek function to get the max(depth)&lt;/P&gt;&lt;P&gt;maxTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;max(depth) as maxDepth&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;OrgHierarchyTmp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vMaxDepth=Peek('maxDepth',0,('maxTable');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 20:50:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399597#M613251</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-08-29T20:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: DO WHILE Loop thorugh Hierarchy</title>
      <link>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399598#M613252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15041234846483899 jive_text_macro" jivemacro_uid="_15041234846483899"&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Do while vDepth &amp;gt; 0&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; LET vDepth = vDepth - 1;&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Loop;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;with initial Depth max value you might as well use a For ... Next loop with &lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptControlStatements/For%20Each.htm" title="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ScriptControlStatements/For%20Each.htm"&gt;FieldValueList&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15041234799816949" jivemacro_uid="_15041234799816949"&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;FOR Each &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vDepth &lt;/SPAN&gt; in FieldValueList('Depth')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ...&lt;/P&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0f0f0f; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt; NEXT &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vDepth&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;hope this helps&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;regards&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:04:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399598#M613252</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2017-08-30T20:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: DO WHILE Loop thorugh Hierarchy</title>
      <link>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399599#M613253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sasi &amp;amp; Marco&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your inputs. It Works now as it should! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1504186018892498 jive_text_macro" jivemacro_uid="_1504186018892498" modifiedtitle="true"&gt;
&lt;P&gt;maxTable:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;max(Depth) as MaxDepth&lt;/P&gt;
&lt;P&gt;Resident&lt;/P&gt;
&lt;P&gt;OrgHierarchyTmp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Let vDepth = Peek('MaxDepth',0,('maxTable'));&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;QUALIFY * ;&lt;/P&gt;
&lt;P&gt;UNQUALIFY [%*];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;For each vMaxDepth in&amp;nbsp; FieldValueList('Depth')&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vTableName = 'Level' &amp;amp; $(vDepth);&lt;/P&gt;
&lt;P&gt;LET vKeyName = '%ID_Datum_Level3' &amp;amp; $(vDepth);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IF vDepth &amp;gt;1 THEN&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;LET vKeyUp&amp;nbsp;&amp;nbsp; =&amp;nbsp; vDepth - 1;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;LET vKeyDown =&amp;nbsp; vDepth + 1;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;LET vKeyNameUp&amp;nbsp;&amp;nbsp; = '%Parten_ID_Datum_Level' &amp;amp; $(vDepth);&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;LET vKeyNameDown = '%Parten_ID_Datum_Level' &amp;amp; $(vKeyDown);&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;
&lt;P&gt;ELSE&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vKeyNameUp&amp;nbsp;&amp;nbsp; = '%ID_Datum_Level_UP_MAX';&lt;/P&gt;
&lt;P&gt;LET vKeyNameDown = '%Parten_ID_Datum_Level2';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;$(vTableName):&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;Parent_ID &amp;amp; '_' &amp;amp; Datum as $(vKeyNameUp),&lt;/P&gt;
&lt;P&gt;ID &amp;amp; '_' &amp;amp; Datum as $(vKeyNameDown),&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;Resident&lt;/P&gt;
&lt;P&gt;OrgHierarchyTmp&lt;/P&gt;
&lt;P&gt;WHERE Depth = $(vDepth);&lt;/P&gt;
&lt;P&gt;LET vDepth = vDepth - 1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next vMaxDepth;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again &amp;amp; Best Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2017 13:28:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/DO-WHILE-Loop-thorugh-Hierarchy/m-p/1399599#M613253</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-31T13:28:23Z</dc:date>
    </item>
  </channel>
</rss>

