Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I'm trying to automatically story my tables into a specific folder with this script:
SET vQVDPath = 'lib://qvd/';
FOR vCount = 0 to NoOfTables()-1
LET vTableName = TableName($(vCount));
STORE $(vTableName) INTO $(vQVDPath) $(vTableName).qvd (qvd);
NEXT vCount
The Script is working fine as soon as I remove the "$(vQVDPath)" part in the second last line. But then all the qvd's are stored in the Apps-Folder of Qlik Sense. If I use the script with the path-variable, I'll only get 1 qvd-file at the correct path. (file is called $(vTableName).qvd then)
Can someone help me? I think I'm missing a minor thing to make this work.
Regards
Chris
Do you mean that $(vTableName) is not expanding when you use vQVDPath?
This sounds like a bug. What I would try is:
SET vQVDPath = 'lib://qvd/';
FOR vCount = 0 to NoOfTables()-1
LET vTableName = TableName($(vCount));
LET vFilePath = vQVDPath & vTableName & '.qvd';
STORE $(vTableName) INTO [$(vFilePath)] (qvd);
NEXT vCount
Do you mean that $(vTableName) is not expanding when you use vQVDPath?
This sounds like a bug. What I would try is:
SET vQVDPath = 'lib://qvd/';
FOR vCount = 0 to NoOfTables()-1
LET vTableName = TableName($(vCount));
LET vFilePath = vQVDPath & vTableName & '.qvd';
STORE $(vTableName) INTO [$(vFilePath)] (qvd);
NEXT vCount
Yes, I was thinking about this being a bug, so maybe one of the Dev's could check this mto .
Beside that, thank you for your answer. Your script works fine!
Regards
Chris
Hi Guys - I tested this script as well and it works for me too - see attached .qvf - (for community reference I attached the .qvf it for other who might want to know how to do this and see it work. I created some sample data (tables and table references) so the script will work out of the box)
let me review the perceived issue and I'll get back to you.
Please copy .qvf file to your C:\Users\<user profile>\Documents\Qlik\Sense\Apps and refresh Qlik Sense Desktop with F5 (if applicable)
Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.
Regards,
Mike Tarallo
Qlik
Hi Guys - I don't think this is a bug, but I am not sure.
I know that I needed to wrap the variable file path in "[...]" - as it evaluated to a lib:\\ path, once I did that the script worked as originally posted. (possibly something with the \\ is messing up the parser??)
This works:
STORE $(vTableName) INTO [$(vQVDPath) $(vTableName).qvd] (qvd);
However, I do find it odd that it does not seem to evaluate $(vTableName) and treats it as a literal -- unless the path is wrapped in [ ].
hic - do you see this as a bug when the variables are being evaluated?
Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.
Regards,
Mike Tarallo
Qlik
@Michael
I did not try doing the expansion inside square brackets. If the expansion works inside square brackets, but not outside, then this either a bug, or at least very inconsistent with all the other places where variable expansion is an operation that happens before the line is evaluated and executed (like Set statements)!
I haven't looked deeper into this, but it sure sounds like a bug. A dollar expansion should always be interpreted as a dollar expansion.
A side comment: When it comes to file names, I prefer to use double quotes "$(vFile)" instead of square brackets [$(vFile)]. Both should normally work, but since a file name potentially could contain square brackets but never double quotes, the latter is safer.
HIC