<?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 Variables with load statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187621#M51224</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try if that works:&lt;/P&gt;&lt;P&gt;Load_Data:&lt;BR /&gt;LOAD RecNo() as Record_Number,&lt;BR /&gt;Task_Name,&lt;BR /&gt;Outline_Level,&lt;BR /&gt;...etc...&lt;BR /&gt;FROM Table;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=1,Task_Name,peek(Level1)) as Level1&lt;BR /&gt;resident Load_Data;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=2,Task_Name,if(Outline_Level&amp;gt;2,peek(Level2))) as Level2&lt;BR /&gt;resident Load_Data;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=3,Task_Name,if(Outline_Level&amp;gt;3,peek(Level3))) as Level3&lt;BR /&gt;resident Load_Data;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Jun 2010 15:39:21 GMT</pubDate>
    <dc:creator>tanelry</dc:creator>
    <dc:date>2010-06-15T15:39:21Z</dc:date>
    <item>
      <title>Variables with load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187618#M51221</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'm exporting information from Project into QlikView as xml however within QlikView I want to be able to drill down the tasks and sub tasks of the project document. I therefore need to assign parent task names to each sub task. Is there any way of using variables within the table load statement? I'm importing the following script:&lt;/P&gt;&lt;P&gt;Regions:&lt;BR /&gt;LOAD ID,&lt;BR /&gt; Task_Name,&lt;BR /&gt; Duration,&lt;BR /&gt; Start_Date,&lt;BR /&gt; Finish_Date,&lt;BR /&gt; Percent_Comp,&lt;BR /&gt; Cost,&lt;BR /&gt; Scheduled_Work,&lt;BR /&gt; Outline_Level&lt;BR /&gt;FROM&lt;/P&gt;&lt;P&gt;Basically want to create a new field called Region and if the Outline_Level equals 1 then use this value for the region, if not use the value in the current variable? So something like if([Outline_Level=1],Task_Name,Variable) as Region. However I don't know if you can use variables within the actual script? SET and LET don't work.&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 16:20:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187618#M51221</guid>
      <dc:creator />
      <dc:date>2010-06-14T16:20:23Z</dc:date>
    </item>
    <item>
      <title>Variables with load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187619#M51222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will work fine but you must call the variable with&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;$(VARIABLE)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jun 2010 21:21:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187619#M51222</guid>
      <dc:creator>fernandotoledo</dc:creator>
      <dc:date>2010-06-14T21:21:58Z</dc:date>
    </item>
    <item>
      <title>Variables with load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187620#M51223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply again Fernando.&lt;/P&gt;&lt;P&gt;I've used variables and knew about the $, however I'm not sure if you can actually set (or let) variables inside a load statement. I've used the following code at the moment, however this loads each line individually, which currently at 3,800 isn't a huge wait. However is there a more efficient way of cleasning the data during the actual load statement?&lt;/P&gt;&lt;P&gt;The code is basically looking at creating 3 additional fields where 3 levels of hierachy from MS project will be saved, this can then be used to drill-down within QlikView. When the Outline level 1 is excountered the variable is changed to the value and is used for all records until an outline level 1 is again encountered (same for levels 2 and 3).&lt;/P&gt;&lt;P&gt;Load_Data:&lt;BR /&gt;LOAD RecNo() as Record_Number,&lt;BR /&gt; Task_Name,&lt;BR /&gt; Duration,&lt;BR /&gt; Start_Date,&lt;BR /&gt; Finish_Date,&lt;BR /&gt; Percent_Comp,&lt;BR /&gt; Cost,&lt;BR /&gt; Scheduled_Work,&lt;BR /&gt; Outline_Level&lt;BR /&gt;FROM Table&lt;BR /&gt;&lt;BR /&gt;Max_Records:&lt;BR /&gt;load max(Record_Number) as Record_Count&lt;BR /&gt;resident Load_Data;&lt;BR /&gt;&lt;BR /&gt;let vRecord_Count = peek('Record_Count',0,'Max_Records');&lt;BR /&gt;let a = 1;&lt;BR /&gt;&lt;BR /&gt;do while a&amp;lt;=vRecord_Count&lt;BR /&gt;&lt;BR /&gt;Base_Data:&lt;BR /&gt;Load *,&lt;BR /&gt; if([Outline_Level]=1,[Task_Name],'$(vLevel1)') as Level1,&lt;BR /&gt; if([Outline_Level]=2,[Task_Name],'$(vLevel2)') as Level2,&lt;BR /&gt; if([Outline_Level]=3,[Task_Name],'$(vLevel3)') as Level3&lt;BR /&gt;resident Load_Data&lt;BR /&gt;Where Record_Number=$(a);&lt;BR /&gt;&lt;BR /&gt;let vOutLineLevel= (lookup('Outline_Level','Record_Number',$(a)));&lt;BR /&gt;let vTaskName= (lookup('Task_Name','Record_Number',$(a)));&lt;BR /&gt;&lt;BR /&gt;let vLevel1= if('$(vOutLineLevel)'=1,'$(vTaskName)','$(vLevel1)');&lt;BR /&gt;let vLevel2= if('$(vOutLineLevel)'=2,'$(vTaskName)','$(vLevel2)');&lt;BR /&gt;let vLevel3= if('$(vOutLineLevel)'=3,'$(vTaskName)','$(vLevel3)');&lt;BR /&gt;&lt;BR /&gt;let a=a+1;&lt;BR /&gt;&lt;BR /&gt;loop&lt;BR /&gt;&lt;BR /&gt;DROP TABLE Load_Data, Max_Records;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 10:34:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187620#M51223</guid>
      <dc:creator />
      <dc:date>2010-06-15T10:34:57Z</dc:date>
    </item>
    <item>
      <title>Variables with load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187621#M51224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try if that works:&lt;/P&gt;&lt;P&gt;Load_Data:&lt;BR /&gt;LOAD RecNo() as Record_Number,&lt;BR /&gt;Task_Name,&lt;BR /&gt;Outline_Level,&lt;BR /&gt;...etc...&lt;BR /&gt;FROM Table;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=1,Task_Name,peek(Level1)) as Level1&lt;BR /&gt;resident Load_Data;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=2,Task_Name,if(Outline_Level&amp;gt;2,peek(Level2))) as Level2&lt;BR /&gt;resident Load_Data;&lt;BR /&gt;&lt;BR /&gt;left join load distinct&lt;BR /&gt;Record_Number,&lt;BR /&gt;if(Outline_Level=3,Task_Name,if(Outline_Level&amp;gt;3,peek(Level3))) as Level3&lt;BR /&gt;resident Load_Data;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 15:39:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187621#M51224</guid>
      <dc:creator>tanelry</dc:creator>
      <dc:date>2010-06-15T15:39:21Z</dc:date>
    </item>
    <item>
      <title>Variables with load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187622#M51225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, much simpler!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jun 2010 16:12:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-with-load-statement/m-p/187622#M51225</guid>
      <dc:creator />
      <dc:date>2010-06-15T16:12:56Z</dc:date>
    </item>
  </channel>
</rss>

