Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problem with a load of multiple files from multiple folders

Hi All

This code fragment is designed to load multiple csv files of a pattern *XBWDO603* from a list of subfolders. It is happy to load numeric folders e.g. 20110711, 20110718 but generates an error "Syntax error, missing/misplaced FROM" with folder 20110705R.  Rename the folder to be numeric 20110705 and the code works.

Anyone got an idea why this might be ?  I am using QV v9.00.7778.9 SR7 x64 ....


// Set the current directory
directory 'c:\data';

// bluefile folders to load
set FolderScope = '20110705R','20110711','20110718','20110725','20110801';

FOR each FilePath in $(FolderScope);

  LOAD $(FilePath) & '\' & filename() as source,
       @1, @2,  @3,  @4 as @4,  @5,  @6,  @7,  @8,  @9,  @10,  @11,  @12,   @13,  @14,   @15,
       left(@8,4) as year,  mid(@8,5,2) as month,
       @2 & @3 & @4 & @5 & @6 & @7 & @8 & @9 & @10 & @11 as unikey,
       if(@4='0012077225','DIRECT','NORMAL') as channel
  FROM [$(FilePath)\*XBWDO603*] (txt, codepage is 1252, no labels, delimiter is '|', msq);

NEXT FilePath;

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try wrapping $(Filepath) with single quotes in first line of LOAD

So:

LOAD '$(FilePath)' & '\' & filename() as source,

.....

View solution in original post

2 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try wrapping $(Filepath) with single quotes in first line of LOAD

So:

LOAD '$(FilePath)' & '\' & filename() as source,

.....

Not applicable
Author

Thanks Rakesh and apologies for the late reply to your correct answer, this worked !

thnx

Ian