<?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: How to assign multiple values to a single variable in script? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954736#M961931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manish,&lt;/P&gt;&lt;P&gt;Thanks for the reply.I want the values to be displayed one by one as loaded in inline table by using a variable as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the listbox by using variable name&lt;/P&gt;&lt;P&gt;=$(val)&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the confusion. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Oct 2015 17:56:06 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-10-24T17:56:06Z</dc:date>
    <item>
      <title>How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954734#M961929</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;I am a newbie to QV, I am trying to assign multiple values to a single variable using LET as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * inline[&lt;/P&gt;&lt;P&gt;Num&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let val=Num;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to display all the values of "Num"&amp;nbsp; when variable "val" is loaded, because when loaded I am getting Null for "val" instead of 1,2,3,4.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Oct 2015 17:24:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954734#M961929</guid>
      <dc:creator />
      <dc:date>2015-10-24T17:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954735#M961930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;&amp;nbsp; Num&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempConcat:&lt;/P&gt;&lt;P&gt;LOAD Concat(Distinct Num,', ') as TempNum Resident Data;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let val = FieldValue('TempNum',1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table TempConcat;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Oct 2015 17:43:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954735#M961930</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-10-24T17:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954736#M961931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manish,&lt;/P&gt;&lt;P&gt;Thanks for the reply.I want the values to be displayed one by one as loaded in inline table by using a variable as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the listbox by using variable name&lt;/P&gt;&lt;P&gt;=$(val)&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the confusion. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Oct 2015 17:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954736#M961931</guid>
      <dc:creator />
      <dc:date>2015-10-24T17:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954737#M961932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why you want to use variable in List Box..&lt;/P&gt;&lt;P&gt;You can simply use Field Num in list box... What is the point of creating variable!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Oct 2015 21:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954737#M961932</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-10-24T21:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954738#M961933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;My requirement consists of an expression to be evaluated and used in a "for" loop. I tried using the expression directly in for loop but it wouldn't work, so I am trying to evaluate the expression using "LET" and then using that variable in for, but even that is not working. So I am trying to evaluate the expression using "LET" first. The expression is&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;for i=num(Addmonths(MaxDate,-12,1)) to num(MaxDate)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Test1:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load&amp;nbsp; *,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;sum(Current12M) as Total,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Key&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Resident Final&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;where Exists(Key);&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Next i;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Oct 2015 10:41:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954738#M961933</guid>
      <dc:creator />
      <dc:date>2015-10-25T10:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954739#M961934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you provide sample data and result you want to achieve using loop?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Oct 2015 15:27:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954739#M961934</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-10-25T15:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign multiple values to a single variable in script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954740#M961935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyanka,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QlikView variables, in contrast to fields, can only hold a single value. In your initial example, you create a field Num with several values, which is fine, and then you are trying to assign all the values of Num to a variable val, which is incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a single field value to be assigned to a variable, you can use one of the functions that can fetch the field value either from a table or from the value list. Check out the following functions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Peek()&lt;/STRONG&gt; lets you peek the field value from a table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FieldValue()&lt;/STRONG&gt; lets you fetch a single value from a list of field values (disregarding of a table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conversely, when you need to use variables in data load statements, you can't use them directly. Instead, you need to use them within a $-sign expansion. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(num_variable) as Field1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '$(string_variable)' as Field2,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out my new book &lt;EM&gt;QlikView Your Business&lt;/EM&gt;. In the book, I describe in detail how to use variables for a variety of analytical needs in the script and in the UI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.amazon.com/gp/product/1118949552/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1118949552&amp;amp;linkCode=as2&amp;amp;tag=natursyner0f-20&amp;amp;linkId=64QJ6MD3O54VZHF7" rel="nofollow"&gt;Check out my new book &lt;EM&gt;QlikView Your Business&lt;/EM&gt;: An expert guide to Business Discovery with QlikView and Qlik Sense&lt;/A&gt;&lt;IMG alt="" border="0" height="1" src="http://ir-na.amazon-adsystem.com/e/ir?t=natursyner0f-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1118949552" style="border: none !important; margin: 0px !important;" width="1" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Oct 2015 22:02:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-assign-multiple-values-to-a-single-variable-in-script/m-p/954740#M961935</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2015-10-25T22:02:37Z</dc:date>
    </item>
  </channel>
</rss>

