<?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 handle Directory statement when target directory does not exist ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182403#M48073</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Rob,&lt;/P&gt;&lt;P&gt;sorry it seems to be a bit complicated to explain. I will try again in a bit more in detail:&lt;/P&gt;&lt;P&gt;I have a comment table:&lt;/P&gt;&lt;P&gt;Comments:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;COMMENT_ID, COMMENT&lt;/P&gt;&lt;P&gt;1, comment_one&lt;/P&gt;&lt;P&gt;2, comment_two&lt;/P&gt;&lt;P&gt;3, comment_three&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;In reality the user can store to each comment files. the files are stored in a way, the they are placed in a sub-dir with the sub-dir-name COMMENT_ID. I want to have a field with the filenames of the comment stored to open the documents from the application&lt;/P&gt;&lt;P&gt;In this example I may have a comment file structure with documents&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\3\comment_three.xls&lt;/P&gt;&lt;P&gt;This are two files for comment 1, no file for comment 2 and one file for comment 3.&lt;/P&gt;&lt;P&gt;What I do now:&lt;/P&gt;&lt;P&gt;For i = 0 to NoOfRows( 'Comments' ) - 1 // for each COMMENT_ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET ActualDir = peek( 'COMMENT_ID', $(i), 'Comments' );&lt;/P&gt;&lt;P&gt;Directory c:\application_comments\$(ActualDir); // set path for files&lt;/P&gt;&lt;P&gt;LET FileList = '*.*';&lt;/P&gt;&lt;P&gt;FOR EACH varFile in FileList (strFileList)&lt;/P&gt;&lt;P&gt;Files:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;$(ActualDir) as FileDir,&lt;/P&gt;&lt;P&gt;$(varFile) as PathFileName&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1;&lt;/P&gt;&lt;P&gt;NEXT varFile&lt;/P&gt;&lt;P&gt;NEXT i&lt;/P&gt;&lt;P&gt;As you see for i = 1 the directory c:\application_comments\2 does not exist because there is no comment file for comment 2&lt;/P&gt;&lt;P&gt;The output of this loop is:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Files&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\3\comment_three.xls&lt;/P&gt;&lt;P&gt;Loading directory c:\application_comments\1\ twice.&lt;/P&gt;&lt;P&gt;What I am looking for is a way to get the information, that directory c.\application_comments\2 does not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Mar 2010 13:31:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-03-17T13:31:10Z</dc:date>
    <item>
      <title>How to handle Directory statement when target directory does not exist ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182399#M48069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to load the existing file names from a range of directories for which the path is coming from a table. I tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[FileDirs:&lt;/P&gt;&lt;P&gt;LOAD FileDir RESIDENT FileDirTable;&lt;/P&gt;&lt;P&gt;For i = 0 to NoOfRows( 'FileDirs' )&lt;/P&gt;&lt;P&gt;LET ActualDir = peek( 'FileDir', $(i), 'FileDirs );&lt;/P&gt;&lt;P&gt;Directory $(ActualDir);&lt;/P&gt;&lt;P&gt;LET FileList = '*.*';&lt;/P&gt;&lt;P&gt;FOR EACH varFile i nFileList (strFileList)&lt;/P&gt;&lt;P&gt;Files:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;$(ActualDir) as FileDir,&lt;/P&gt;&lt;P&gt;$(varFile) as PathFileName&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1;&lt;/P&gt;&lt;P&gt;NEXT varFile&lt;/P&gt;&lt;P&gt;NEXT i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine unless the FileDir exists as a directory but if not it reads the files from the previous directory a second time. Any change to get checked if the directory exists?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 17:36:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182399#M48069</guid>
      <dc:creator />
      <dc:date>2010-03-16T17:36:28Z</dc:date>
    </item>
    <item>
      <title>How to handle Directory statement when target directory does not exist ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182400#M48070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would give it a try with checking the size of the File, which would deliver 0, in case that there is no file:&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;FOR EACH varFile i nFileList (strFileList)&lt;BR /&gt;IF FILESIZE($(varFile)) &amp;gt; 0 THEN&lt;BR /&gt;Files:&lt;BR /&gt;LOAD ....&lt;BR /&gt;END IF&lt;BR /&gt;NEXT varFile&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;HTH&lt;BR /&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 19:54:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182400#M48070</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2010-03-16T19:54:08Z</dc:date>
    </item>
    <item>
      <title>How to handle Directory statement when target directory does not exist ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182401#M48071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Peter for the quick response.&lt;/P&gt;&lt;P&gt;However, the problem is not that there is no file, the problem is, that the complete directory does not exist. QV than keeps the last directory that worked and simply takes the files in that directory.&lt;/P&gt;&lt;P&gt;To give example data:&lt;/P&gt;&lt;P&gt;Lets say Table.FileDir has two values : c:\temp\Dir1 and c:\temp\Dir2&lt;/P&gt;&lt;P&gt;in c:\temp\dir1 exists with two files file1.xls and file2.xls&lt;/P&gt;&lt;P&gt;c:\temp\dir2 does not exist&lt;/P&gt;&lt;P&gt;First Directory statement loads the two filenames, second Directory statement loads this two filenames again.&lt;/P&gt;&lt;P&gt;Unfortunately the Directory statement do not return an error status message when teh directory does not exist.&lt;/P&gt;&lt;P&gt;To be honest I tried to find a solution with QV - not using VB because I am lacking VB skills...&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Mar 2010 21:37:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182401#M48071</guid>
      <dc:creator />
      <dc:date>2010-03-16T21:37:23Z</dc:date>
    </item>
    <item>
      <title>How to handle Directory statement when target directory does not exist ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182402#M48072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not following where you are setting strFileList. But I think you want to delete the Directory statement and do something like:&lt;/P&gt;&lt;P&gt;FOR EACH varFile i nFileList ('$(ActualDir)\$(strFileList)')&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 01:50:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182402#M48072</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-03-17T01:50:03Z</dc:date>
    </item>
    <item>
      <title>How to handle Directory statement when target directory does not exist ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182403#M48073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Rob,&lt;/P&gt;&lt;P&gt;sorry it seems to be a bit complicated to explain. I will try again in a bit more in detail:&lt;/P&gt;&lt;P&gt;I have a comment table:&lt;/P&gt;&lt;P&gt;Comments:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;COMMENT_ID, COMMENT&lt;/P&gt;&lt;P&gt;1, comment_one&lt;/P&gt;&lt;P&gt;2, comment_two&lt;/P&gt;&lt;P&gt;3, comment_three&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;In reality the user can store to each comment files. the files are stored in a way, the they are placed in a sub-dir with the sub-dir-name COMMENT_ID. I want to have a field with the filenames of the comment stored to open the documents from the application&lt;/P&gt;&lt;P&gt;In this example I may have a comment file structure with documents&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\3\comment_three.xls&lt;/P&gt;&lt;P&gt;This are two files for comment 1, no file for comment 2 and one file for comment 3.&lt;/P&gt;&lt;P&gt;What I do now:&lt;/P&gt;&lt;P&gt;For i = 0 to NoOfRows( 'Comments' ) - 1 // for each COMMENT_ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET ActualDir = peek( 'COMMENT_ID', $(i), 'Comments' );&lt;/P&gt;&lt;P&gt;Directory c:\application_comments\$(ActualDir); // set path for files&lt;/P&gt;&lt;P&gt;LET FileList = '*.*';&lt;/P&gt;&lt;P&gt;FOR EACH varFile in FileList (strFileList)&lt;/P&gt;&lt;P&gt;Files:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;$(ActualDir) as FileDir,&lt;/P&gt;&lt;P&gt;$(varFile) as PathFileName&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1;&lt;/P&gt;&lt;P&gt;NEXT varFile&lt;/P&gt;&lt;P&gt;NEXT i&lt;/P&gt;&lt;P&gt;As you see for i = 1 the directory c:\application_comments\2 does not exist because there is no comment file for comment 2&lt;/P&gt;&lt;P&gt;The output of this loop is:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Files&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.xls&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\1\comment_one.pdf&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;c:\application_comments\3\comment_three.xls&lt;/P&gt;&lt;P&gt;Loading directory c:\application_comments\1\ twice.&lt;/P&gt;&lt;P&gt;What I am looking for is a way to get the information, that directory c.\application_comments\2 does not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Mar 2010 13:31:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-Directory-statement-when-target-directory-does-not/m-p/182403#M48073</guid>
      <dc:creator />
      <dc:date>2010-03-17T13:31:10Z</dc:date>
    </item>
  </channel>
</rss>

