<?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 headscratcher: script works with one set of data, not another in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436381#M611447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello people&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been trying to put together a script to calculate the total sum of business days covered by a report.&lt;/P&gt;&lt;P&gt;The point is letting users define the starting and ending month on load and calculate accurate occupation rates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm defining variables for user input&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.Start = Input('jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec', 'FIRST MONTH OF YOUR REPORT?');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.NbMonths = Input('How many months does your report cover', 'ALMOST DONE');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then load a set of data defining the number of business days for each month of the year&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt;"&gt;LOAD lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jan, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;feb, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;mar, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;apr, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;may, 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jun, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jul, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;aug, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;sep, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;oct, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;nov, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;dec, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then calculate / identify the rows for starting month, and ending month&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.StartNb = FieldIndex('lMonths',vReport.Start);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.End = FieldValue('lMonths',vReport.StartNb + vReport.NbMonths - 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.EndNb = FieldIndex('lMonths',vReport.End);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then execute a simple loop to accumulate the values from starting to ending month&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vCounter = vReport.StartNb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vSum = FieldValue('Bizdays_permonth',vCounter);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;DO WHILE vCounter &amp;lt; vReport.EndNb ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vCounter = vCounter + 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vTemp = FieldValue('Bizdays_permonth',vCounter);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vSum = vSum + vTemp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LOOP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mystery is as follows: calculation with dataset above is always wrong.&lt;/P&gt;&lt;P&gt;Say I start in February, for 3 months. Result should be 20 + 22 + 20 = 62&lt;/P&gt;&lt;P&gt;But script outcomes 60.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However exact same script, with different values below actually comes to correct result...&lt;/P&gt;&lt;P&gt;Feb, for 3 months, outcomes 2 + 3 + 4 = 9&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt;"&gt;LOAD lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jan, 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;feb, 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;mar, 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;apr, 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;may, 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jun, 6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jul, 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;aug, 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;sep, 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;oct, 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;nov, 11&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;dec, 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-size: 13.3333px;"&gt;I'm sure it must be a total fluke of mathematical magic, but. Any idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Attaching test file so you can see it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried step by step debugging, the problem seems to occur in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Oct 2017 14:10:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-10-11T14:10:41Z</dc:date>
    <item>
      <title>headscratcher: script works with one set of data, not another</title>
      <link>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436381#M611447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello people&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been trying to put together a script to calculate the total sum of business days covered by a report.&lt;/P&gt;&lt;P&gt;The point is letting users define the starting and ending month on load and calculate accurate occupation rates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm defining variables for user input&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.Start = Input('jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec', 'FIRST MONTH OF YOUR REPORT?');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.NbMonths = Input('How many months does your report cover', 'ALMOST DONE');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then load a set of data defining the number of business days for each month of the year&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt;"&gt;LOAD lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jan, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;feb, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;mar, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;apr, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;may, 19&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jun, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jul, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;aug, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;sep, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;oct, 22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;nov, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;dec, 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then calculate / identify the rows for starting month, and ending month&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.StartNb = FieldIndex('lMonths',vReport.Start);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.End = FieldValue('lMonths',vReport.StartNb + vReport.NbMonths - 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vReport.EndNb = FieldIndex('lMonths',vReport.End);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then execute a simple loop to accumulate the values from starting to ending month&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vCounter = vReport.StartNb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vSum = FieldValue('Bizdays_permonth',vCounter);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;DO WHILE vCounter &amp;lt; vReport.EndNb ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vCounter = vCounter + 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vTemp = FieldValue('Bizdays_permonth',vCounter);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LET vSum = vSum + vTemp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;LOOP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mystery is as follows: calculation with dataset above is always wrong.&lt;/P&gt;&lt;P&gt;Say I start in February, for 3 months. Result should be 20 + 22 + 20 = 62&lt;/P&gt;&lt;P&gt;But script outcomes 60.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However exact same script, with different values below actually comes to correct result...&lt;/P&gt;&lt;P&gt;Feb, for 3 months, outcomes 2 + 3 + 4 = 9&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3366ff; font-size: 10pt;"&gt;LOAD lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;lMonths, Bizdays_permonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jan, 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;feb, 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;mar, 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;apr, 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;may, 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jun, 6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;jul, 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;aug, 8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;sep, 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;oct, 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;nov, 11&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;dec, 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-size: 13.3333px;"&gt;I'm sure it must be a total fluke of mathematical magic, but. Any idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Attaching test file so you can see it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried step by step debugging, the problem seems to occur in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2017 14:10:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436381#M611447</guid>
      <dc:creator />
      <dc:date>2017-10-11T14:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: headscratcher: script works with one set of data, not another</title>
      <link>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436382#M611448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the explanation for this behavior is rather simple. Function &lt;SPAN style="font-family: 'courier new', courier;"&gt;FieldValue()&lt;/SPAN&gt; returns the value that is present in the position as specified by the second parameter. But those values are lifted from the Symbol table of the field, not from the table column(s) that make up a particular field. And a field Symbol table stores every distinct value &lt;EM&gt;only once&lt;/EM&gt;.&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;For the working data, the symbol table of field &lt;SPAN style="font-family: 'courier new', courier;"&gt;Bizdays_permonth&lt;/SPAN&gt; contains these values:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;For the non-working data, the symbol table of field &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Bizdays_permonth&lt;/SPAN&gt; contains these values:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;22, 20, 19, 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and nothing more...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The order in which symbol table strings are stored is the one in which you load them. So position 3 contains the value from row 5 (may) and position 4 contains the value from row 6 (jun).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to fix this using the code you already wrote, replace the &lt;SPAN style="font-family: 'courier new', courier;"&gt;FieldValue()&lt;/SPAN&gt; function by a call to &lt;A href="http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/InterRecordFunctions/LookUp.htm"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Lookup()&lt;/SPAN&gt;&lt;/A&gt;. That one does peek into the column of the internal table, instead of the symbol table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2017 22:02:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436382#M611448</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2017-10-11T22:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: headscratcher: script works with one set of data, not another</title>
      <link>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436383#M611449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter is absolutely right, and that's why you shouldn't use FieldValue() to query data table values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can probably use Lookup(), but I think the straight forward replacement would be the Peek() function.&lt;/P&gt;&lt;P&gt;[Just take care about the different index start compared to FieldIndex(), Peek() starts table record indexing from 0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vSum = &lt;STRONG&gt;Peek&lt;/STRONG&gt;('Bizdays_permonth',&lt;STRONG&gt;vCounter-1&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;DO WHILE vCounter &amp;lt; vReport.EndNb ;&lt;/P&gt;&lt;P&gt;LET vCounter = vCounter + 1;&lt;/P&gt;&lt;P&gt;LET vTemp = Peek('Bizdays_permonth',vCounter-1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides this, I wouldn't do the aggregation of your table values like this, using a DO WHILE loop and Peek() the table record values, but that's not the topic of your thread nor your issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2017 22:42:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436383#M611449</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-10-11T22:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: headscratcher: script works with one set of data, not another</title>
      <link>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436384#M611450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aww, total noob mistake &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;P&gt;That's great, thank you guys!&lt;/P&gt;&lt;P&gt;I must admit, I've only started recently, and I like to tinker - if the script had not worked at all I would have kept looking. But I was just confused by the inconsistency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, thanks again for taking the time &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Oct 2017 07:59:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/headscratcher-script-works-with-one-set-of-data-not-another/m-p/1436384#M611450</guid>
      <dc:creator />
      <dc:date>2017-10-12T07:59:48Z</dc:date>
    </item>
  </channel>
</rss>

