<?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: Dynamic execute command with date variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379080#M420649</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Susant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I debug I can see the script runs up to the FinalList point. then the code then it stops the execute doens't run.&lt;/P&gt;&lt;P&gt;I have allow execute enabled and I have been able to execute a deletion of other files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my Execute line is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXECUTE CMD.EXE /C del&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;"C:\Users\.QVD\$(a).qvd";&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried without the quote and without the .qvd but nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Oct 2017 10:59:49 GMT</pubDate>
    <dc:creator>didierodayo</dc:creator>
    <dc:date>2017-10-17T10:59:49Z</dc:date>
    <item>
      <title>Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379078#M420647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a year worth of of qvd and would like to start deleting any qvd older than 6 months. The qvds are saved with the date in the name.&lt;/P&gt;&lt;P&gt;QVDs:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;employ_20170131&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; color: #ff6600;"&gt;employ_20170122&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600; font-size: 13.3333px;"&gt;employ_20170210&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;employ_20170930&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;employ_20171016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Execute command :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;EXECUTE CMD.EXE /C del "&lt;SPAN style="color: #ff6600; font-size: 13.3333px;"&gt;employ_$vVariable&lt;/SPAN&gt;.qvd";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;How could I write a dynamic execute query that will go through the qvds and only delete any qvd older than 6 month ago like the ones highlighted in red?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 02:58:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379078#M420647</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-10-17T02:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379079#M420648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a filename with the list to be deleted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR Each File in filelist (C:\Qlikview\*.qvd)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filelist:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;if(&amp;nbsp;&amp;nbsp; date(right($(File)',8),'YYYYMMDD') &amp;lt; date(addmonths(Today() ,-6),'YYYYMM') ,$(File)')&amp;nbsp;&amp;nbsp; as TobeDeleted, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;autogenerate 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Store that list into a variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileDelete:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load&amp;nbsp; concat(distinct&amp;nbsp; chr(39)&amp;amp;TobeDeleted&amp;amp;chr(39),',') as FinalList&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident Filelist ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let&amp;nbsp; Vlist = peek('FileDelete',0,'FinalList') ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proceed with the deletion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each a in $(Vlist)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;EXECUTE CMD.EXE /C del&amp;nbsp; $(a)&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Next &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 09:51:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379079#M420648</guid>
      <dc:creator>qliksus</dc:creator>
      <dc:date>2017-10-17T09:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379080#M420649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Susant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I debug I can see the script runs up to the FinalList point. then the code then it stops the execute doens't run.&lt;/P&gt;&lt;P&gt;I have allow execute enabled and I have been able to execute a deletion of other files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my Execute line is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXECUTE CMD.EXE /C del&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;"C:\Users\.QVD\$(a).qvd";&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried without the quote and without the .qvd but nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 10:59:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379080#M420649</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-10-17T10:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379081#M420650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think whatever it is it is between the let and the For Each.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;Let&amp;nbsp; Vlist = peek('FileToBeDeleted',0,'FinalList') ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;For each a in $(Vlist)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have tried the following separately and it worked as well.&lt;/P&gt;&lt;P&gt;Let a = 'mytest.qvd'&lt;/P&gt;&lt;P&gt;EXECUTE CMD.EXE /C del&amp;nbsp; "C:\Users\.QVD\$(a)";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure what it going on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 11:29:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379081#M420650</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-10-17T11:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379082#M420651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's&amp;nbsp; the value getting stored into the variable&amp;nbsp; &lt;SPAN style="color: #ff6600;"&gt;Vlist &lt;/SPAN&gt; also just type exit script before the let statement and see whether you can see values in the File list field &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 11:40:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379082#M420651</guid>
      <dc:creator>qliksus</dc:creator>
      <dc:date>2017-10-17T11:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379083#M420652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I can see all the values in the Finallist field. So the concat worked. But the variable is not loading. I can't see it after the load. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 11:48:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379083#M420652</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-10-17T11:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic execute command with date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379084#M420653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the script that worked for anyone with the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filelist:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lOAD&lt;/P&gt;&lt;P&gt;FileBaseName() as TobeDeleted&lt;/P&gt;&lt;P&gt;From C:\QVD\*.qvd (qvd)&lt;/P&gt;&lt;P&gt;where Len(Purgechar(Right(FileBaseName(),8), '0123456789.'))=0 and Date#(right(FileBaseName(),8),'YYYYMMDD') &amp;lt; date(addmonths(Today() ,-6),'YYYYMM');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FileToBeDeleted:&lt;/P&gt;&lt;P&gt;load&amp;nbsp; concat(distinct chr(39)&amp;amp;TobeDeleted&amp;amp;chr(39),',') as FinalList&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident Filelist ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table&amp;nbsp; Filelist;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let&amp;nbsp; Vlist = peek('FinalList',0,'FileToBeDeleted') ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each name in $(Vlist)&lt;/P&gt;&lt;P&gt;Let a = 'C:\QVD\$(name).qvd';&lt;/P&gt;&lt;P&gt;EXECUTE CMD.EXE /C del&amp;nbsp; "$(a)";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Oct 2017 03:34:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-execute-command-with-date-variable/m-p/1379084#M420653</guid>
      <dc:creator>didierodayo</dc:creator>
      <dc:date>2017-10-23T03:34:49Z</dc:date>
    </item>
  </channel>
</rss>

