<?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 Expression-fed variable not returning the anticipated value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654678#M239196</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;I'm relatively new to QlikView and have learned a great deal so far from all of your super advice by reading discussions on a variety of topics.&amp;nbsp; This time, however, I couldn't find an answer to my question so I thought it best to ask you directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am tasked with creating a line chart where the results of different list box picks are filtered down in the chart results.&amp;nbsp; No problem - that's how a chart works in QV.&amp;nbsp; When a user makes multiple selections from the CallWeekEnding list box (which contains a week ending date for each week), the chart should create a new line.&amp;nbsp; This will allow users to compare one week's results to another week. The chart dimension will be a daily (Monday - Sunday) breakdown.&amp;nbsp; Users will be able to select/compare up to 4 weeks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This caused me to think about set analysis.&amp;nbsp; But, how do I capture and isolate individual selections from the CallWeekEnding list box?&amp;nbsp; And how do I take those selections and graph them separately?&amp;nbsp; Here is my thought process.&amp;nbsp; Isolate individual selections by creating expression-fed variables.&amp;nbsp; Use the values of those variables in separate expressions in the chart so that each expression is graphed separately.&amp;nbsp; It seemed like a great plan, but it didn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created 5 variables:&amp;nbsp; vSelectedCallWeekEnding1 through vSelectedCallWeek4, and&amp;nbsp; vSelectedCallWeekEnding.&amp;nbsp;&amp;nbsp; For the latter, the definition is GetFieldSelection(CallWeekEnding).&amp;nbsp; The definition I created for vSelectedCallWeekEnding1 is this:&amp;nbsp; If(GetSelectedCount(CallWeekEnding)&amp;gt;=1,SubField($(vSelectedCallWeekEnding),',',1),'').&amp;nbsp; Basically, if there is at least one item selected from Call Week Ending, then using the SubField function, parse the value saved in vSelectedCallWeekEnding using comma as a delimiter, and return the first delimited value.&amp;nbsp;&amp;nbsp; vSelectedCallWeekEnding2 through vSelectedCallWeek4 use the same definition, except I change out the "1" in the definition for 2, 3 or 4, depending on the variable I am trying to define.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I thought if I took vSelectedCallWeekEnding1 and put it in a chart expression, I would get a graphed line.&amp;nbsp; Wrong.&amp;nbsp; Didn't happen.&amp;nbsp; So, I created three text boxes to test my values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 1:&amp;nbsp; =$(vSelectedCallWeekEnding1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The value returned was 7/13/2014, which is exactly what I have selected in the list box.&amp;nbsp; So far so good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 2:&amp;nbsp; =If($(vSelectedCallWeekEnding1)='7/13/2014','Equal','Not Equal').&amp;nbsp;&amp;nbsp; This was to test whether or not the value saved in the variable matched what I thought it should be -- '7/13/2014'.&amp;nbsp;&amp;nbsp; If it matches, the expression should return 'Equal'.&amp;nbsp;&amp;nbsp; And that's just what it did.&amp;nbsp; Yay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 3:&amp;nbsp;&amp;nbsp; Compare the set analysis expression I attempted in my chart to the same expression with the hard coded value 7/13/2014.&amp;nbsp;&amp;nbsp;&amp;nbsp; =Count({$&amp;lt;CallWeekEnding={'$(vSelectedCallWeekEnding1)'}&amp;gt;session_key) &amp;amp; Chr(10) &amp;amp; Count({$&amp;lt;CallWeekEnding={'7/13/2014'}&amp;gt;}session_key)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The results were surprising to me.&amp;nbsp; The text box returned 0&amp;nbsp; 100000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, despite the fact that in text box 2, I performed a test to compare the value of vSelectedCallWeekEnding1 to '7/13/2014' and the test came back as the values were equal, the expressions in text box 3 that performed set analysis upon the variable and the hard-coded value evaluated differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please explain to me why they evaluated differently, and if there is a better approach to graphing up to 4 different week-ending picks as separate expressions in the same chart(perhaps alternate state?) than what I have conceptualized here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Oct 2014 13:45:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-10-03T13:45:21Z</dc:date>
    <item>
      <title>Expression-fed variable not returning the anticipated value</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654678#M239196</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;I'm relatively new to QlikView and have learned a great deal so far from all of your super advice by reading discussions on a variety of topics.&amp;nbsp; This time, however, I couldn't find an answer to my question so I thought it best to ask you directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am tasked with creating a line chart where the results of different list box picks are filtered down in the chart results.&amp;nbsp; No problem - that's how a chart works in QV.&amp;nbsp; When a user makes multiple selections from the CallWeekEnding list box (which contains a week ending date for each week), the chart should create a new line.&amp;nbsp; This will allow users to compare one week's results to another week. The chart dimension will be a daily (Monday - Sunday) breakdown.&amp;nbsp; Users will be able to select/compare up to 4 weeks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This caused me to think about set analysis.&amp;nbsp; But, how do I capture and isolate individual selections from the CallWeekEnding list box?&amp;nbsp; And how do I take those selections and graph them separately?&amp;nbsp; Here is my thought process.&amp;nbsp; Isolate individual selections by creating expression-fed variables.&amp;nbsp; Use the values of those variables in separate expressions in the chart so that each expression is graphed separately.&amp;nbsp; It seemed like a great plan, but it didn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created 5 variables:&amp;nbsp; vSelectedCallWeekEnding1 through vSelectedCallWeek4, and&amp;nbsp; vSelectedCallWeekEnding.&amp;nbsp;&amp;nbsp; For the latter, the definition is GetFieldSelection(CallWeekEnding).&amp;nbsp; The definition I created for vSelectedCallWeekEnding1 is this:&amp;nbsp; If(GetSelectedCount(CallWeekEnding)&amp;gt;=1,SubField($(vSelectedCallWeekEnding),',',1),'').&amp;nbsp; Basically, if there is at least one item selected from Call Week Ending, then using the SubField function, parse the value saved in vSelectedCallWeekEnding using comma as a delimiter, and return the first delimited value.&amp;nbsp;&amp;nbsp; vSelectedCallWeekEnding2 through vSelectedCallWeek4 use the same definition, except I change out the "1" in the definition for 2, 3 or 4, depending on the variable I am trying to define.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I thought if I took vSelectedCallWeekEnding1 and put it in a chart expression, I would get a graphed line.&amp;nbsp; Wrong.&amp;nbsp; Didn't happen.&amp;nbsp; So, I created three text boxes to test my values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 1:&amp;nbsp; =$(vSelectedCallWeekEnding1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The value returned was 7/13/2014, which is exactly what I have selected in the list box.&amp;nbsp; So far so good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 2:&amp;nbsp; =If($(vSelectedCallWeekEnding1)='7/13/2014','Equal','Not Equal').&amp;nbsp;&amp;nbsp; This was to test whether or not the value saved in the variable matched what I thought it should be -- '7/13/2014'.&amp;nbsp;&amp;nbsp; If it matches, the expression should return 'Equal'.&amp;nbsp;&amp;nbsp; And that's just what it did.&amp;nbsp; Yay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Text box 3:&amp;nbsp;&amp;nbsp; Compare the set analysis expression I attempted in my chart to the same expression with the hard coded value 7/13/2014.&amp;nbsp;&amp;nbsp;&amp;nbsp; =Count({$&amp;lt;CallWeekEnding={'$(vSelectedCallWeekEnding1)'}&amp;gt;session_key) &amp;amp; Chr(10) &amp;amp; Count({$&amp;lt;CallWeekEnding={'7/13/2014'}&amp;gt;}session_key)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The results were surprising to me.&amp;nbsp; The text box returned 0&amp;nbsp; 100000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, despite the fact that in text box 2, I performed a test to compare the value of vSelectedCallWeekEnding1 to '7/13/2014' and the test came back as the values were equal, the expressions in text box 3 that performed set analysis upon the variable and the hard-coded value evaluated differently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please explain to me why they evaluated differently, and if there is a better approach to graphing up to 4 different week-ending picks as separate expressions in the same chart(perhaps alternate state?) than what I have conceptualized here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:45:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654678#M239196</guid>
      <dc:creator />
      <dc:date>2014-10-03T13:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Expression-fed variable not returning the anticipated value</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654679#M239197</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;I think you need an = sign - try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count({$&amp;lt;CallWeekEnding={'$(=vSelectedCallWeekEnding1)'}&amp;gt;session_key)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;HTH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Jonathan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:51:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654679#M239197</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-10-03T13:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Expression-fed variable not returning the anticipated value</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654680#M239198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try using the complete set into variable ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt;defile variable&lt;/P&gt;&lt;P&gt;Set vMaxDate = {'$(=max(Date))'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Date=$(vMaxDate)&amp;gt;}Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 14:06:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654680#M239198</guid>
      <dc:creator />
      <dc:date>2014-10-03T14:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Expression-fed variable not returning the anticipated value</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654681#M239199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I gave it a try but had no luck.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 18:25:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-fed-variable-not-returning-the-anticipated-value/m-p/654681#M239199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-06T18:25:59Z</dc:date>
    </item>
  </channel>
</rss>

