<?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 How to create a daily record automatically with script? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934573#M963384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do a dashboard for a restaurant and I am stuck in a problem on how to deal with the menus and each individual item from a menu to calculate the cost. I got two tables; one is ‘Item’, which is used to record the Item ID, unit cost of each item and the date of unit cost change. Another one is ‘Item_Result’, which is aim to record the daily cost changes of each item automatically&lt;/P&gt;&lt;P&gt;For example, in the original ‘Item’ table, there are altogether 3 records for” Item A” since the cost has changed thrice. And what I want to do is to create a daily record for every item to show the cost changes, just like what is shown in the pic below.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/101384_2.PNG" style="height: 386px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101383_1.PNG" style="height: 380px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;The problem is that I fail to create the record consecutively so that the daily record shown can carry on until today. Just like ic0002, since there is no change under the unit cost from the 'item' table, the script does not tend to generate records automatically. What is the problem of my script? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item:&lt;/P&gt;&lt;P&gt;LOAD Item_ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item_Name, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Modified Date for cost], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Unit Cost]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Sample Data v0.1.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Item);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTable:&lt;/P&gt;&lt;P&gt;load *, if(previous(Item_ID)=Item_ID, previous([Modified Date for cost]),[Modified Date for cost]+1) as NextDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Sample Data v0.1.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Item)&lt;/P&gt;&lt;P&gt;order by Item_ID, [Modified Date for cost] desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Item;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item_Result:&lt;/P&gt;&lt;P&gt;Load Item_ID, date([Modified Date for cost] + IterNo() -1) as [Modified Date for cost],[Unit Cost]&lt;/P&gt;&lt;P&gt;Resident TempTable&lt;/P&gt;&lt;P&gt;while [Modified Date for cost] + IterNo() - 1 &amp;lt; NextDate&amp;nbsp; &lt;/P&gt;&lt;P&gt;order by Item_ID, [Modified Date for cost];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE TempTable;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Oct 2015 06:55:32 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-10-08T06:55:32Z</dc:date>
    <item>
      <title>How to create a daily record automatically with script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934573#M963384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do a dashboard for a restaurant and I am stuck in a problem on how to deal with the menus and each individual item from a menu to calculate the cost. I got two tables; one is ‘Item’, which is used to record the Item ID, unit cost of each item and the date of unit cost change. Another one is ‘Item_Result’, which is aim to record the daily cost changes of each item automatically&lt;/P&gt;&lt;P&gt;For example, in the original ‘Item’ table, there are altogether 3 records for” Item A” since the cost has changed thrice. And what I want to do is to create a daily record for every item to show the cost changes, just like what is shown in the pic below.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/101384_2.PNG" style="height: 386px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101383_1.PNG" style="height: 380px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;The problem is that I fail to create the record consecutively so that the daily record shown can carry on until today. Just like ic0002, since there is no change under the unit cost from the 'item' table, the script does not tend to generate records automatically. What is the problem of my script? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item:&lt;/P&gt;&lt;P&gt;LOAD Item_ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item_Name, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Modified Date for cost], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Unit Cost]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Sample Data v0.1.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Item);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTable:&lt;/P&gt;&lt;P&gt;load *, if(previous(Item_ID)=Item_ID, previous([Modified Date for cost]),[Modified Date for cost]+1) as NextDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Sample Data v0.1.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Item)&lt;/P&gt;&lt;P&gt;order by Item_ID, [Modified Date for cost] desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Item;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Item_Result:&lt;/P&gt;&lt;P&gt;Load Item_ID, date([Modified Date for cost] + IterNo() -1) as [Modified Date for cost],[Unit Cost]&lt;/P&gt;&lt;P&gt;Resident TempTable&lt;/P&gt;&lt;P&gt;while [Modified Date for cost] + IterNo() - 1 &amp;lt; NextDate&amp;nbsp; &lt;/P&gt;&lt;P&gt;order by Item_ID, [Modified Date for cost];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE TempTable;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 06:55:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934573#M963384</guid>
      <dc:creator />
      <dc:date>2015-10-08T06:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a daily record automatically with script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934574#M963385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Item:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD Item_ID,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item_Name,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Modified Date for cost],&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Modified Date for cost]) as TempDateKey,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Unit Cost] &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FROM&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Sample Data v0.1.xlsx]&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(ooxml, embedded labels, table is Item);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Join(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Item)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Item_Name ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;MinDate + IterNo() - 1 AS &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TempDateKey&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;While Iterno() &amp;lt;= MaxDate - MinDate + 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Item_Name ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Modified Date for cost]) as MaxDate,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Modified Date for cost]) as MinDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Resident Item;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FinalItem:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Item_Name ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TempDateKey) AS Item_Date,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(IsNull(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Unit Cost]&lt;/SPAN&gt;), Previous(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Unit Cost]),&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Unit Cost]) AS UnitCost&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Resident Item&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Order by Item_Name , &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TempDateKey&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 13:27:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934574#M963385</guid>
      <dc:creator />
      <dc:date>2015-10-08T13:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a daily record automatically with script?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934575#M963386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An error message appears.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="3.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101507_3.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Oct 2015 02:40:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-daily-record-automatically-with-script/m-p/934575#M963386</guid>
      <dc:creator />
      <dc:date>2015-10-09T02:40:53Z</dc:date>
    </item>
  </channel>
</rss>

