<?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 FieldValue returning NULL when a previous value reoccurs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348933#M129264</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to Qlikview and this might have a very simple solution but I'm really struggling.&lt;/P&gt;&lt;P&gt;I'm extracting values from two fields (city, region) and some cites are in the same region.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;City&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&lt;/P&gt;&lt;P&gt;City1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegionA&lt;/P&gt;&lt;P&gt;City2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegionA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;LOAD City, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;C&gt;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&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 x = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;let y = FieldValue('Region', 2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In debug this would give me x = RegionA but y = &amp;lt;NULL&amp;gt;.&lt;/P&gt;&lt;P&gt;If I instead used the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let x = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;let y = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would give me x = RegionA and y = RegionA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the reference for FieldValue NULL is given when the number is larger than the rows in the document and that's not the case, please help! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 May 2012 01:31:11 GMT</pubDate>
    <dc:creator>marcelo_7</dc:creator>
    <dc:date>2012-05-13T01:31:11Z</dc:date>
    <item>
      <title>FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348933#M129264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to Qlikview and this might have a very simple solution but I'm really struggling.&lt;/P&gt;&lt;P&gt;I'm extracting values from two fields (city, region) and some cites are in the same region.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;City&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&lt;/P&gt;&lt;P&gt;City1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegionA&lt;/P&gt;&lt;P&gt;City2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RegionA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;LOAD City, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;C&gt;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&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 x = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;let y = FieldValue('Region', 2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In debug this would give me x = RegionA but y = &amp;lt;NULL&amp;gt;.&lt;/P&gt;&lt;P&gt;If I instead used the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let x = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;let y = FieldValue('Region', 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would give me x = RegionA and y = RegionA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the reference for FieldValue NULL is given when the number is larger than the rows in the document and that's not the case, please help! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 01:31:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348933#M129264</guid>
      <dc:creator>marcelo_7</dc:creator>
      <dc:date>2012-05-13T01:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348934#M129265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure about the reference statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the fieldvalue index references the distinct values of that field in load order, it has nothing to do with table rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I remember the index starts with one&amp;nbsp; and you only have one distinct value in your table, RegionA.&lt;/P&gt;&lt;P&gt;So that is why your code using index = 1 retrieves the value and your code using index=2 does not - there is no second distinct value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the number of distinct values in your field using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vNumValuesRegion = FieldValueCount('Region');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;/P&gt;&lt;P&gt;Stefan &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: corrected index start&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 08:29:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348934#M129265</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-05-13T08:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348935#M129266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;Let vNumValuesRegion = FieldValueCount('Region');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;vNumValuesRegion is 1 even though I have two rows with the same name so it's like you said. I found a function peek() which does not care about distinct values. Thank you!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 12:33:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348935#M129266</guid>
      <dc:creator>marcelo_7</dc:creator>
      <dc:date>2012-05-13T12:33:55Z</dc:date>
    </item>
    <item>
      <title>FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348936#M129267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right, Peek() is the function to use if you want to address table values (in contrast to fieldvalue() if you want to address field values, as mentioned, this is a big difference).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the inconsistency in QV, peek() index starts with zero for the first row...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 13:37:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348936#M129267</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-05-13T13:37:41Z</dc:date>
    </item>
    <item>
      <title>FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348937#M129268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh I think I get it, FieldValue is for retrieving the column name and peek is for the actual rows? Is that correct? If so that would explain why it ignores recurring fields because there can only be one instance of a column for a table to make sense. Otherwise I don't understand what the purpose of FieldValue is since peek can do the same and more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 21:09:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348937#M129268</guid>
      <dc:creator>marcelo_7</dc:creator>
      <dc:date>2012-05-13T21:09:55Z</dc:date>
    </item>
    <item>
      <title>FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348938#M129269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A field can contain values of different tables (if used as key field). Fieldvalue() will access all distinct values of that field (think of it more like the list box object) while peek() will only access values of one table (if you don't state the table name, the current table used in the load will be used) and it does so row based, so also retrieving duplicate values (think of it more like a table object, but showing all rows (like using rowno() as dimension).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence, fieldvalue() and peek() both have their meaningful use, but in your case, I guess you want to use peek().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 21:41:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348938#M129269</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-05-13T21:41:05Z</dc:date>
    </item>
    <item>
      <title>FieldValue returning NULL when a previous value reoccurs</title>
      <link>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348939#M129270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your list box/table object analogy made it easy to understand. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 21:51:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FieldValue-returning-NULL-when-a-previous-value-reoccurs/m-p/348939#M129270</guid>
      <dc:creator>marcelo_7</dc:creator>
      <dc:date>2012-05-13T21:51:51Z</dc:date>
    </item>
  </channel>
</rss>

