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

Problem in script : Variable keep value in memory

Hello, I have a problem with the following script:

LET vFilePath ='lib://AttachedFiles';
FOR EACH file in FileList('$(vFilePath)/*.csv'); // Loops each excel file in the given Folder
LET vFileDate = Date(Left(right(file,28),8)); // Gets the year portion from the filename
LET vMaxDate = Rangemax(vFileDate, vMaxDate); // Gets the max year for every iteration
NEXT


Data:
LOAD *
FROM [$(vFilePath)/$(vMaxDate)-product-extract.csv]
(txt, utf8, embedded labels, delimiter is '|', msq);

The script works very well, that is, it will fetch me the last CSV file on my server.

However, when I change the name of the path where I have to look for the CSV file, I have the following error:

Cannot open file: 'lib://AttachedFiles/20181028-product-extract.csv'

While the new folder contains exactly the same CSV. I feel that my vFilePath variable keeps track of the folder path.

How could I solve that?

 

Thanks in advance 🙂

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

When you say "change the name of the path" do you mean you edit the folder in the connection named "AttachedFiles"? Or something else?

 

-Rob

jmialoundama
Specialist
Specialist
Author

Hello Rob,

I have toi differents connexion:
- first connexion : lib://Attachements
- 2nd connexion : lib://.....\Approvisionnement Logvad

My second connexion contains exactly same csv files.
When i change the name of path I have this error : «Cannot open file lib://Attachementd\20181118-product-extract.

So, i think My variable vFilePath keep in memory the folder wich receive at first and when i Want to change the path it’s not works.
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This doesn't look like a valid connection name.

.....\Approvisionnement Logvad

The .... is sure to confuse the script parser.

 

-Rob