Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gal_polak
Creator
Creator

Calling NEXT in FOR EACH in multiple location or by condition

Hi,

I'm using the for each to go over folders and files in my system, 

and i was trying to create a condition to skip some files so baiscally what i want to do is like this:

FOR EACH fld in DirList(vMyDir) 
  IF fld < vMyCondition then
     NEXT fld
  ELSE
     /* do something */
  ENDIF
NEXT fld

 

 

But i get error when it is like that, 

any other ways someone know? can share? 

Labels (3)
2 Replies
dieterwoestemeier
Contributor II
Contributor II

It looks like you don't need the "next fld" inside the if statement. Try something like this:

 

FOR EACH fld in DirList(vMyDir) 
  IF fld >= vMyCondition then
     /* do something */
  ENDIF
NEXT fld

 

 

gal_polak
Creator
Creator
Author

Thx, 

so i thought about this kind of solution, 

but because i'm dealing with an old code that wasn't written by me this kind of change will have more consequences,

there for i want a simple if with another NEXT, 

which i'm starting to understand is not possible in Qlik