Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Below is the script I'm using. For some reason, the QVD isn't pulling the data properly, could someone explain why that might be happening?
Thanks.
Sub DoDir (Root)
For Each Ext In 'csv' // filetype to search for in current directory
For Each File In FileList (Root & '\*.' & Ext)
USERS_BY_USB_LIST:
Load
if(wildmatch('$(File)', '*Users_*'), '$(File)') as Name1,
if(IsNull(if(wildmatch('$(File)', '*Users_*'), '$(File)')),'Exclude','$(File)') AS FileTest1,
FileTime('$(File)') as FileTime1,
FileSize('$(File)') AS FileSize1,
RangeSum(Peek('FileCount')) as FileCount1
Autogenerate 1;
Next File
Next Ext
For Each Dir In DirList (Root & '\*') // search in subdirectories
Call DoDir (Dir)
Next Dir
End Sub
Call DoDir ('$(vESDDataLocation)$(vUSB)'); // Starting point
//Exclude the Microsoft Temporary Filesa; Exclude any file name starting with the ~ character
USERS_BY_USB_LIST:
FIRST 1 LOAD
Name1 AS File_Name,
FileTime1 AS File_Time,
FileCount1 AS File_Count,
FileSize1 AS File_Size,
FileTest1 AS File_Test
Resident LIST_ENCRYPTED_FILE
where index(Name1,'~') = 0 and FileSize1 <> 0 and FileTest1 <> 'Exclude'
ORDER BY FileTime1 DESC;
//use variables to store the most recent files file names
LET vUSBFile = FieldValue('File_Name', 1);
USERS_BY_USB_LIST:
LOAD [Number of Destination],
[User Name],
[Computer Name],
USB
FROM
(txt, codepage is 1252, embedded labels, delimiter is ',');
STORE USERS_BY_USB_LIST into $(vQVDlocation)USB_LIST.qvd (qvd);
DROP TABLE USERS_BY_USB_LIST;
do you get any error when you run this script?
You are using table name USERS_BY_USB_LIST multiple time. Do you expect Qlik to concatenate the two tables?
Then maybe use the CONCATENATE LOAD prefix to force concatenation.
And use a different table name in your SUB.
How do you define proper here? I mean what is not proper in the way QVD is getting stored?
No Errors
Its only pulling
Name1
FileTime1
FileCount1
FileSize1
FileTest1