<?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 Load Script - Using Variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299592#M1180958</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;Try using the SubField() in the load script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CoverageAreaTopLevel:&lt;/P&gt;&lt;P&gt;load [ID] as [ID],&lt;/P&gt;&lt;P&gt;if(index([coverage area], ':', 1)&amp;lt;&amp;gt;0,SubField([coverage area], ':',1) ) as [Coverage Group]&lt;/P&gt;&lt;P&gt;resident timeentries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Feb 2012 15:07:45 GMT</pubDate>
    <dc:creator>jagan</dc:creator>
    <dc:date>2012-02-20T15:07:45Z</dc:date>
    <item>
      <title>Load Script - Using Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299591#M1180957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;Is there a way of using variables and interacting with the fields inside a load script without each statement having to load a value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script needs to analyse a field [coverage area] that is already resident from a previous load statement and based on finding a substring ':' decide how to load it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 examples below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first example doesn't work but is more logical to me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set vPosition = 1; &lt;/P&gt;&lt;P&gt;set vSubString = 'substring'; &lt;/P&gt;&lt;P&gt;CoverageAreaTopLevel: &lt;/P&gt;&lt;P&gt;load [ID] as [ID], &lt;/P&gt;&lt;P&gt;$(vposition) = index([coverage area], ':', 1), &lt;/P&gt;&lt;P&gt;if($(vposition)&amp;lt;&amp;gt;1,left([coverage area], $(vposition))) as [Coverage Group],&lt;/P&gt;&lt;P&gt;resident timeentries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second example works, but I find there is a limit to the amount of nested logic that can be contained within one statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CoverageAreaTopLevel:&lt;/P&gt;&lt;P&gt;load [ID] as [ID],&lt;/P&gt;&lt;P&gt;if(index([coverage area], ':', 1)&amp;lt;&amp;gt;0,left([coverage area],index([coverage area], ':', 1))) as [Coverage Group]&lt;/P&gt;&lt;P&gt;resident timeentries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;JP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2012 14:54:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299591#M1180957</guid>
      <dc:creator />
      <dc:date>2012-02-20T14:54:11Z</dc:date>
    </item>
    <item>
      <title>Load Script - Using Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299592#M1180958</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;Try using the SubField() in the load script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CoverageAreaTopLevel:&lt;/P&gt;&lt;P&gt;load [ID] as [ID],&lt;/P&gt;&lt;P&gt;if(index([coverage area], ':', 1)&amp;lt;&amp;gt;0,SubField([coverage area], ':',1) ) as [Coverage Group]&lt;/P&gt;&lt;P&gt;resident timeentries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2012 15:07:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299592#M1180958</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-02-20T15:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Using Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299593#M1180959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not quite what I was after, I was more looking for a more reading friendly way of laying out the code, so it's easier to understand the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More of.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If&lt;/P&gt;&lt;P&gt;  Xxxx&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;  Xxxx&lt;/P&gt;&lt;P&gt;End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if this can be done in a load script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sent from my iPad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 07:52:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Using-Variables/m-p/299593#M1180959</guid>
      <dc:creator />
      <dc:date>2012-02-22T07:52:58Z</dc:date>
    </item>
  </channel>
</rss>

