Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tayariib85
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.

tayariib85_0-1669373218121.png

What am I doing wrong in this script ?

tayariib85_0-1669372804210.png

Regards

Labels (3)
1 Reply
marcus_sommer

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