Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

For Each loop

Hello guys,

I am using the following script to concatenate new files. The problem with this foreach loop , if I have two file on the same day in the folder, it will only upload the latest file (TP12-copy(2)) because it is 10:21 and it will ignore the TP12-Copy.


What am I doing wrong in this script ?



Labels (3)
1 Reply
MVP & Luminary
MVP & Luminary

It depends on the ordering of the files within the folder and filelist() isn't an own Qlik function else just called a Windows function. AFAIK there is nothing what could be directly influenced on this feature unless you change the filenames manually or with an extra logic.

I'm not absolutely sure what your requirements are but I assume you could prevent this behaviour quite easily - by moving the statement: let vMaxDate = vDate; out of the loop below the next file statement. You may need some extra logic here to prevent that vMaxDate could be overwritten with a date in the past or is completely erased if no loop iteration is executed or any other unexpected stuff happens - maybe just: let vMaxDate = rangemax(vMaxDate, vDate);

- Marcus