Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Looping Error in Qlikview

Hi All,

i want to pick up the Recent file from the Given folder and coding is picking up the recent file as expected

but when i removed the recent file

for example: i have removed the file which is having the data file of - sample_Download_20180209

when i reload the data Qlikview throwing the Error "Cannot open file '\\Naren\in\sample\sample_Download_20180209.CSV'The system cannot find the file specified."

My Doubt is When i removed the Current data file it need to fetch the previous data file from the folder sample_Download_20180208

Coding as Follow:

Let vFilePath ='\\Naren\in\sample\sample_Download_';

FOR EACH file in FileList('$(vFilePath)*.csv');  // Loops each excel file in the given Folder  t

LET vYears = mid(file,26,27);

LET vDates = mid(vYears,14,14);

LET vSM = Rangemax(vDates,vSM);

Next

Sample:

ID,

Name,

Desg

FROM 

[$(vFilePath)$(vSM).csv]

(txt, utf8, embedded labels, delimiter is '|', no quotes, no eof)

loveisfailpcammaertstalwar1luismadrizelixir.seajetqlikcheepirishettyjontydkpikaushalkaushik

Tags (1)
4 Replies
Highlighted

Re: Looping Error in Qlikview

Hi,

Try this,

Let vFilePath ='\\Naren\in\sample\sample_Download_';

Let vSM =;

FOR EACH file in FileList('$(vFilePath)*.csv');  // Loops each excel file in the given Folder  t

LET vYears = mid(file,26,27);

LET vDates = mid(vYears,14,14);

LET vSM = Rangemax(vDates,vSM);

Next

Sample:

ID,

Name,

Desg

FROM

[$(vFilePath)$(vSM).csv]

(txt, utf8, embedded labels, delimiter is '|', no quotes, no eof)

Highlighted

Re: Looping Error in Qlikview

You can also try,

Let vFilePath ='\\Naren\in\sample\sample_Download_';

Let vSM =;

FOR EACH file in FileList('$(vFilePath)*.csv');  // Loops each excel file in the given Folder  t

LET vDates = Replace(Subfield(SubField(file,'\',-1),'_',-1),'.csv','');

LET vSM = Rangemax(vDates,vSM);

Next

Sample:

ID,

Name,

Desg

FROM

[$(vFilePath)$(vSM).csv]

(txt, utf8, embedded labels, delimiter is '|', no quotes, no eof)

Highlighted
MVP
MVP

Re: Looping Error in Qlikview

Highlighted
Master
Master

Re: Looping Error in Qlikview

Hi,

what is expected output here?

Have you test this in a texbox With mid function?

LET vYears = mid(file,26,27);  mid(file,1,26) gives you the Whole filename

LET vDates = mid(vYears,14,14);

LET vSM = Rangemax(vDates,vSM);