Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
FakeJupiter
Creator
Creator

Variable in Store function not working properly

Hi there,

Been trying to figure this out without success on my own.

I want to export a table with a custom name, that is dependent on a variable.

This is what works:

 

 

let testMonth = '123';
Store EfektivitateExport into 'W:\SecretLocation\$(testMonth).csv' (txt);

 

 

If I run this code here, it exports a file named "123.csv" in the desied location.

However, if I define the variable as:

 

 

let testMonth = maxmonth;

 

 

where maxmonth is a variable that has a value of "8" , the exported file has blank name.

I would like to know what can I do to make a dynamic export file name that works.

 

Thanks

 

EDIT:

When I make a table with field maxmonth, it gives one result "8", so I assume that there is no problem.
When I make a variable in script let testMonth = maxmonth; the testMonth variable has no value after the reload? Why is that?

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

If maxmonth is really a (valid) variable you don't need to create an extra variable testMonth to use it within the store-statement else you could use maxmonth.

But I assume you don't mean a variable else a fieldvalue. To grab any fieldvalue within the script you need a load or functions like peek() or fieldvalue() which may look in your case like:

let testMonth = fieldvalue('maxmonth', 1);

- Marcus

View solution in original post

1 Reply
marcus_sommer

If maxmonth is really a (valid) variable you don't need to create an extra variable testMonth to use it within the store-statement else you could use maxmonth.

But I assume you don't mean a variable else a fieldvalue. To grab any fieldvalue within the script you need a load or functions like peek() or fieldvalue() which may look in your case like:

let testMonth = fieldvalue('maxmonth', 1);

- Marcus