You could add a trace on the variables to see what values they are being set with.
Is there a "v" missing from MaxFolder, should it be vMaxFolder?
set vNewestFolder = max(MaxFolder);
trace vNewestFolder = $(vNewestFolder) ;
set vFileName = 'D:\Apps2\CUSTOMER RELATIONS\VendorOrderStatus_Emails\' & $(vNewestFolder) & '*';
trace vFileName = $(vFileName ) ;
(ooxml, embedded labels, table is [*]);
set vNewestFolder = max(MaxFolder); will set the variable vNewestFolder to the string value 'max(MaxFolder)'. That's probably not what you want. If you have a table with a field MaxFolder you can retrieve the max value of that like this:
LOAD max(MaxFolder) as MaxMaxFolder
LET vNewestFolder = peek('MaxMaxFolder');
DROP TABLE Temp;
Works for me. But table is [*] will not work. If you want to load all the sheets from an excel file you'll have to use a different approach using odbc and the sqltables function. See this discussion for an example: http://community.qlik.com/message/546602#546602
Thanks for your help guys!
//Script to remove all preceding and post fluff from the folder name - resulting in a YYYYMMDD value
//Preceding load grabs the most recent value
max(SourceFile) as MaxFolder;
Mid(SourceFile, index(SourceFile,'Emails')+7,index(SourceFile,'\2')-index(SourceFile,'Emails')+2) as SourceFile
//Peek the most recent value, MaxFolder
Let vNewestFolder = peek('MaxFolder');
//Load all *.xlsx files from the folder that matches the vMaxFolder = YYYYMMDD that is most recent
(ooxml, embedded labels)