Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

character issue while reading ' apostrophe

I am writing a code to get list of all folder contents and one of the file has  ' (apostrophe)

File Name    Hill's document.qvw

when it read this file in table ,, it show up two apostrophe

         Output   Hill''s document.qvw

Please help

vRootFolder = '\\Server\E$\QlikView_Docs\Users';

DoDir (Root)
FOR Each Ext in 'qvw'// 'qvd'
FOR Each File in filelist (Root & '\*.' & Ext)
User_Contents:
LOAD
   
//'$(File)' as Name1,
    lower ( mid (  '$(File)' ,  Index('$(File)','\',-1)+1,Len('$(File)')) ) as [DocName],
     'Live Applications'
as Live
// FileSize( '$(File)' ) as Size,
  //FileTime( '$(File)' ) as FileTime
  autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root & '\*' )

call DoDir (Dir)

NEXT Dir

ENDSUB



CALL DoDir ('$(vRootFolder)')

4 Replies
Not applicable
Author

Can some one please help?

Clever_Anjos
Employee
Employee

FOR Each File in filelist (Root & '\*.' & Ext)

Let File=purgechar(File,chr(39));  // cleans apostrophe'

hic
Former Employee
Former Employee

Use a "Load ... Inline" instead. Then it will load the correct file names:

For each vFile in FileList('Path\*.txt')

  LOAD

    FileName,

    FileSize(FileName) as Size,

  FileTime(FileName) as FileTime

  inline

  [FileName

  $(vFile)];

Next vFile

HIC

Not applicable
Author

Thanks ,, it worked for me.. is this a bug?

( midFileNameIndex(FileName,'\',-1)+1,Len(FileName)) ) as [FileName]
Inline
  
[FileName
     $(File)]
;

Why Name below brings two apotrophe if file has one apostrophe?   like I have Hill ' s , it returns Hill ' 's

Each File in filelist (Root & '\*.' & Ext)
User_Contents:
LOAD
    '$(File)'
as Name,