<?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 Re: Adding Date field to table from same Excel file in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759806#M719070</link>
    <description>&lt;P&gt;Check out my attached solution.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_0-1604920410870.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43812i44E4ED2E2A13F90F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Vegar_0-1604920410870.png" alt="Vegar_0-1604920410870.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;for each _file in filelist ('./Resultaat du*.xlsx')

MapMonth:
MAPPING LOAD * inline [
M_txt, M_no
novembre, 11
décembre, 12
];

FilePeriod:
first 1 LOAD
Makedate( SubField(A,' ',-1), applymap('MapMonth',SubField(A,' ',-2)) , SubField(A,' ',-3)) as Period
FROM
[$(_file)]
(ooxml, no labels, table is Sheet1);

LET vDate = peek('Period',-1,'FilePeriod'); //You will need to convert this into a date by some means 

DROP TABLE FilePeriod;
Result:
LOAD Période, 
     Enjeux, 
     [Marge Th.], 
     [Lim. Basse], 
     Rapports, 
     MoneyRoom, 
     [Marge Réelle], 
     Solde,
     '$(vDate)' as %date
FROM
[$(_file)]
(ooxml, embedded labels, header is 1 lines, table is Sheet1)
WHERE(Période &amp;lt;&amp;gt; 'Total' And not IsNull(Enjeux));

LET vDate=;
next

call Calendar ('%date')&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 09 Nov 2020 11:15:06 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2020-11-09T11:15:06Z</dc:date>
    <item>
      <title>Adding Date field to table from same Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759760#M719068</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;Every day I receive an Excel file with the turnover of the day. The only problem is that the date is on the first line, and I want to add it to a table and then read it in with the rest of the tables in the same file, so far I haven't been able to get it, so please help!&lt;/P&gt;&lt;P&gt;The columns and row in the Excel file look like this&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Résultat du samedi 07 novembre 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Période&lt;/TD&gt;&lt;TD&gt;Enjeux&lt;/TD&gt;&lt;TD&gt;Marge Th.&lt;/TD&gt;&lt;TD&gt;Lim. Basse&lt;/TD&gt;&lt;TD&gt;Rapports&lt;/TD&gt;&lt;TD&gt;MoneyRoom&lt;/TD&gt;&lt;TD&gt;Marge Réelle&lt;/TD&gt;&lt;TD&gt;Solde&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But should look like this in Qlikview&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Période&lt;/TD&gt;&lt;TD&gt;Enjeux&lt;/TD&gt;&lt;TD&gt;Marge Th.&lt;/TD&gt;&lt;TD&gt;Lim. Basse&lt;/TD&gt;&lt;TD&gt;Rapports&lt;/TD&gt;&lt;TD&gt;MoneyRoom&lt;/TD&gt;&lt;TD&gt;Marge Réelle&lt;/TD&gt;&lt;TD&gt;Solde&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added the files I worked with, the tryouts are in the qvw file. But with every attempt, I saw the values double in the end result.&lt;/P&gt;&lt;P&gt;Cheers, Danny&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 18:58:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759760#M719068</guid>
      <dc:creator>dannysci</dc:creator>
      <dc:date>2020-11-20T18:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Date field to table from same Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759799#M719069</link>
      <description>&lt;P&gt;You may use something like this:&lt;/P&gt;&lt;P&gt;temp: first 1 load date(date#(replace(A, 'Résultat du samedi ', ''), 'DD MMMM YYYY')) as temp&lt;BR /&gt;from Excel (ooxml, no labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;final: load *, peek('temp', 0, 'temp') as Date&lt;BR /&gt;from Excel (ooxml, embedded labels, table is Sheet1, header is 2 lines);&lt;/P&gt;&lt;P&gt;drop table temp;&lt;/P&gt;&lt;P&gt;For the converting of the string into a real date it's important to specify the exact format-pattern which must also fit with the default-variables for the data-interpreting at the beginning of the script. If they are mandatory different you may use some more string/pick-functions to fill a makedate() with them.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 11:06:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759799#M719069</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-11-09T11:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Date field to table from same Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759806#M719070</link>
      <description>&lt;P&gt;Check out my attached solution.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_0-1604920410870.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43812i44E4ED2E2A13F90F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Vegar_0-1604920410870.png" alt="Vegar_0-1604920410870.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;for each _file in filelist ('./Resultaat du*.xlsx')

MapMonth:
MAPPING LOAD * inline [
M_txt, M_no
novembre, 11
décembre, 12
];

FilePeriod:
first 1 LOAD
Makedate( SubField(A,' ',-1), applymap('MapMonth',SubField(A,' ',-2)) , SubField(A,' ',-3)) as Period
FROM
[$(_file)]
(ooxml, no labels, table is Sheet1);

LET vDate = peek('Period',-1,'FilePeriod'); //You will need to convert this into a date by some means 

DROP TABLE FilePeriod;
Result:
LOAD Période, 
     Enjeux, 
     [Marge Th.], 
     [Lim. Basse], 
     Rapports, 
     MoneyRoom, 
     [Marge Réelle], 
     Solde,
     '$(vDate)' as %date
FROM
[$(_file)]
(ooxml, embedded labels, header is 1 lines, table is Sheet1)
WHERE(Période &amp;lt;&amp;gt; 'Total' And not IsNull(Enjeux));

LET vDate=;
next

call Calendar ('%date')&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 11:15:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759806#M719070</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-11-09T11:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Date field to table from same Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759825#M719071</link>
      <description>&lt;P&gt;Thank you Vegar for the quick reply,&amp;nbsp; this solution works great!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 12:35:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-Date-field-to-table-from-same-Excel-file/m-p/1759825#M719071</guid>
      <dc:creator>dannysci</dc:creator>
      <dc:date>2020-11-09T12:35:38Z</dc:date>
    </item>
  </channel>
</rss>

