Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

loading data issues

hi all,

i want to check before loading data in qvw if the file is on teh shared drive or not

so what is syntax of the if function in script and if not found give a pop up message

if file = true then   ---------is this syntax corect as this is not working properly at my end like even if file is present or not it goes to "else statement"

load * from file

else

msgbox " file not present yet" --------is this syntax correct as this is not working and giving an error

endif

please help

4 Replies
hic
Former Employee
Former Employee

I would suggest a message-free execution, by using

For each vFile in FileList('C.\path\Filename.csv')

     Load * from [$(vFile)]

Next vFile

It is a loop, but if you do not use any wildcards in the mask (the parameter of FileList()), then it will be like an existence test.

HIC

Not applicable
Author

thanks for the response but i am not able to implement in my script. let me give you more color..

i have 4 files with different names which i have defined in 4 different variables:

let file1=''

let file2=''

let file3=''

let file4=''

then i say

load * from file1

concatenate

load * from file2

.

.

.

.

how can i write the above for loop in this scenario

thanks

hic
Former Employee
Former Employee

You shouldn't use both ' and [ and quoting symbols. ' is enough.

Hence:

let file1='y:\path\file.xls'

let file2='y:\path\file1.xls'

let file3='y:\path\file2.xls'

let file4='y:\path\file3.xls'

For each vFileName in file1, file2, file3, file4

     Load * from [$(vFileName)] ... ;

Next vFileName

...or skip the Let statements altogether:

For each vFileName in 'y:\path\file.xls', 'y:\path\file1.xls', 'y:\path\file2.xls', 'y:\path\file3.xls'

     Load * from [$(vFileName)] ... ;

Next vFileName

...and skip the hard-coding:

For each vFileName in FileList('y:\path\*.xls')

     Load * from [$(vFileName)] ... ;

Next vFileName

HIC

Not applicable
Author

Hi,

the above syntax is helpful but not for this dashboard.

i want if anyone of 4 files are not present, it should exit the for loop.

the reason is i ran the above syntax and as files for today were not present it ran 4 times and popped up error message saying files not present.

please advise

thanks