<?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 Applymap for Dates problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210093#M1208162</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying o use applymap for date values and am having trouble getting the correct values. I am generating a date table with correspoinding date numbers ( as in 0 for the first date to n for the last date). This is my mapping table. In my other table I am trying to pull the dateno from the mapping table based on another date field. My script is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Let vMinDate = num(Date#('01/01/2009','DD/MM/YYYY'));&lt;BR /&gt;Let vMaxDate = num(Date#('31/12/2009','DD/MM/YYYY'));&lt;BR /&gt;mHolidays:&lt;BR /&gt;mapping LOAD Date(Date,'DD/MM/YYYY') as Date,1&lt;BR /&gt;FROM&lt;BR /&gt;Holidaylist.xls&lt;BR /&gt;(biff, embedded labels, table is holidays$);&lt;BR /&gt;Datestmp:&lt;BR /&gt;Load Date($(vMinDate)+rowno()-1) as Date&lt;BR /&gt;autogenerate($(vMaxDate)-$(vMinDate)+1);&lt;BR /&gt;Dates:&lt;BR /&gt;mapping Load Date,&lt;BR /&gt; rangesum(peek('DateNo'),if(match(num(Weekday(Date)),6)=0,if(applymap('mHolidays',Date)=1,0,1),0)) as DateNo&lt;BR /&gt; resident Datestmp;&lt;BR /&gt;drop table Datestmp;&lt;BR /&gt;tbluser:&lt;BR /&gt;LOAD sdat,&lt;BR /&gt; applymap('Dates',sdat) as sdatno,&lt;BR /&gt; user&lt;BR /&gt;FROM&lt;BR /&gt;test.xls&lt;BR /&gt;(biff, embedded labels, table is Sheet1$);&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The problem is that the value I am getting is 1 for all the fields instead of their dateno. Is this something to do with date formats? My date format is DD/MM/YYYY and if I write an inline table with date and dateno (not autogenerated), it seems to work. Can someone help me out here. I am attaching a sample file.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jan 2010 23:39:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-01-28T23:39:24Z</dc:date>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210093#M1208162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying o use applymap for date values and am having trouble getting the correct values. I am generating a date table with correspoinding date numbers ( as in 0 for the first date to n for the last date). This is my mapping table. In my other table I am trying to pull the dateno from the mapping table based on another date field. My script is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;Let vMinDate = num(Date#('01/01/2009','DD/MM/YYYY'));&lt;BR /&gt;Let vMaxDate = num(Date#('31/12/2009','DD/MM/YYYY'));&lt;BR /&gt;mHolidays:&lt;BR /&gt;mapping LOAD Date(Date,'DD/MM/YYYY') as Date,1&lt;BR /&gt;FROM&lt;BR /&gt;Holidaylist.xls&lt;BR /&gt;(biff, embedded labels, table is holidays$);&lt;BR /&gt;Datestmp:&lt;BR /&gt;Load Date($(vMinDate)+rowno()-1) as Date&lt;BR /&gt;autogenerate($(vMaxDate)-$(vMinDate)+1);&lt;BR /&gt;Dates:&lt;BR /&gt;mapping Load Date,&lt;BR /&gt; rangesum(peek('DateNo'),if(match(num(Weekday(Date)),6)=0,if(applymap('mHolidays',Date)=1,0,1),0)) as DateNo&lt;BR /&gt; resident Datestmp;&lt;BR /&gt;drop table Datestmp;&lt;BR /&gt;tbluser:&lt;BR /&gt;LOAD sdat,&lt;BR /&gt; applymap('Dates',sdat) as sdatno,&lt;BR /&gt; user&lt;BR /&gt;FROM&lt;BR /&gt;test.xls&lt;BR /&gt;(biff, embedded labels, table is Sheet1$);&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The problem is that the value I am getting is 1 for all the fields instead of their dateno. Is this something to do with date formats? My date format is DD/MM/YYYY and if I write an inline table with date and dateno (not autogenerated), it seems to work. Can someone help me out here. I am attaching a sample file.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2010 23:39:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210093#M1208162</guid>
      <dc:creator />
      <dc:date>2010-01-28T23:39:24Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210094#M1208163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can someone please help with this? I have also tried using map.. using. Bu the same results.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jan 2010 03:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210094#M1208163</guid>
      <dc:creator />
      <dc:date>2010-01-30T03:05:59Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210095#M1208164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you explain, what the purpose is in the calculation?&lt;BR /&gt;So far you have managed to replace certain dates with a "1", which is most likely not wanted.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jan 2010 11:57:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210095#M1208164</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2010-01-30T11:57:18Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210096#M1208165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;Thanks for responding. The real scenario is that I have a database of jobs done with various dates for each job eg. job uploaded on, data preperation completed on, coding completed on, reveiw completed on, job submitted on. Need to find out the turn aournd time at each stage. Each job is a single record with all these dates. Also the turn aournd is based on the number of actual working days. One way was to have a formula which counts the working days. I have that working. But by this method, I am creating datenumbers as suggested by one of the members (Morgan) - &lt;A href="http://community.qlik.com/forums/p/24482/93503.aspx#93503"&gt;http://community.qlik.com/forums/p/24482/93503.aspx#93503&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The advantage is that the calculatin for Turn around time will become simple in terms of subtracting the datenumbers.&lt;/P&gt;&lt;P&gt;This is the reason, I am trying to map the date numbers from a mapping table of dates and date numbers.&lt;/P&gt;&lt;P&gt;I hope I have been able to explain.&lt;/P&gt;&lt;P&gt;I want to know whether I am using the applymap correctly. If yes, why would it not work.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jan 2010 12:24:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210096#M1208165</guid>
      <dc:creator />
      <dc:date>2010-01-30T12:24:12Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210097#M1208166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have not worked that much with apply-map, but think that expression are evaluated only after the running of the script. Have you tried other solution? My first approach would be to load the holidays and then to evaluate the dates with EXISTS-function, like IF(EXISTS(MyDate), 0, 1).*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* actually you may use just the EXISTS(MyDate) and end with either 0 or -1 as result.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jan 2010 15:58:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210097#M1208166</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2010-01-30T15:58:06Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210098#M1208167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;The autogenerate and getting the dateno part of the script runs perfectly. I have tested this. The problem is arising only when mapping the dates. If I use an inline load of the dates and then work with the applymap, it works. Attached is the sample. So I am not sure where is the difference between this inline table and the autogenerated table.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jan 2010 16:25:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210098#M1208167</guid>
      <dc:creator />
      <dc:date>2010-01-30T16:25:34Z</dc:date>
    </item>
    <item>
      <title>Applymap for Dates problem</title>
      <link>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210099#M1208168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone help me out in understanding what is going wrong in what I am doing.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 00:29:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Applymap-for-Dates-problem/m-p/210099#M1208168</guid>
      <dc:creator />
      <dc:date>2010-02-06T00:29:33Z</dc:date>
    </item>
  </channel>
</rss>

