Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've got a QVW that scans file information to help build auditing tables, and it runs fine when I run it locally on the desktop version. However, whe I go to run it on the server and publish it on the access point, it will fail right away. The code is modified from the meta scanner QVW.
The script can't seem to find the final Files Table.
Here is a copy of the script:
UNQUALIFY *;
Looptable:
LOAD * INLINE [
FileFolder, Environment
Z:\Qlikview\Data, $(vEnvironment)
];
Exception:
LOAD * INLINE [
DenyPath
MetaData
];
// --------------------------------------------------
// Main loop through the folders holding the files
// --------------------------------------------------
FOR X = 1 to fieldvaluecount('FileFolder');
let dodirpath = fieldvalue('FileFolder',$(X));
let Env = fieldvalue('Environment',$(X));
if dodirpath = 'RelativePath' then
let dodirpath=replace(Documentpath(),Documentname(),'')&'$(RelativePath)';
endif
Sub DoDir(Root)
for each Ext in $(Suffix)
for each File in filelist (Root&'\*.'&Ext)
// Finding exceptions in the file structure
SET denydirpath = 0;
for Y = 1 to fieldvaluecount('DenyPath')
let vDenyPath = fieldvalue('DenyPath',$(Y));
let denydirpath = denydirpath + SubStringCount(lower('$(File)'),lower('$(vDenyPath)'));
Next Y
if $(denydirpath) = 0 then
FileListTMP:
Load
Upper(FileName) & '_' & Date(Today(), 'YYYY-MM-DD') as LoadDateKey,
FileName as FileName, // Modified 5/2/11 BPN
Date(Today(), 'YYYY-MM-DD') as LoadDate,
lower(subfield(FileName,'\',-1)) as DocName, // Modified 5/2/11 BPN
FileSize(FileName) as Size,
FileTime(FileName) as FileTime,
makedate(year(FileTime(FileName)), month(FileTime(FileName)),day(FileTime(FileName))) as FileDate,
'$(dodirpath)' as RootPath,
left(FileName,len(FileName) - len(subfield(FileName,'\',-1))-1) as Path,
lower(right(FileName,Len(FileName)-index(FileName,'.',-1))) as Extension,
'$(Env)' as Environment,
1 as FileCount;
Load * Inline [
FileName
"$(File)" ];
endif
Next File
Next Ext
For each Dir in Dirlist(Root&'\*')
Call DoDir(Dir)
Next Dir
End sub
Call DoDir('$(dodirpath)')
Next X
drop table Looptable;
Files:
LOAD LoadDateKey,
FileName,
Mid(FileName, 16) as FileNameTrim,
LoadDate,
DocName,
Size,
FileTime,
FileDate,
RootPath,
Path,
Extension,
Environment,
FileCount,
RESIDENT FileListTMP;
drop table FileListTMP;
store Files into Files.QVD (QVD);
Drop table Files;
I suspect that the mapped drive that's called Z: on your local machine, might be called differently on the server. Perhaps you need to replace the Path with the UNC path like \\server\folder\...
I did map it out on the server under the same account as the server. I however, did try as you said, and I'm still coming up with errors. It almost looks like it's not looping properly. It tries to store the Fields table into Fields.QVD before it has finished populating it.
It seems like the script will run fine after that error, since I set the errormode to 0 and the script executed fine. (it came up with errors, but the data was accurate).
If you have tried it with errormode = 0, what is the contents of ScriptErrorList?
Regards,
Gordon
It is Table Not Found. In particular it can't find FileListTMP when it goes to make the Files Table.