Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello qlikviewers,
i would like to insert a timestamp which must display how old the source is or the status of the source file when it is update. for example i am using a excel data and i would like to display the date and time of the source file. or how old it is.
result must be like 26.04.2013 09:10:01
thanks
Mark
Hi,
You can run the below script to get the excel's last updated time and then store into variable and show on dashboard.
SUB DoDir (Root)
FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'
FOR Each File in filelist (Root&'\*.' &Ext)
LOAD
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
Regards,
Kaushik Solanki
this displays the last reload of the application. but i want to get the timestamp of the excel file. which is my source data.
So you wanna display when the excel file was created?
SET vTIMEStart = Now(); //When extraction Start
SET vTIMEEnd = Now(); //When extraction End
Inline:
LOAD * Inline [
StartTime,EndTime
$(vTIMEStart),$(vTIMEEnd)];
i want to display when the excel was last updated (it is same as when it is created)
Hi,
You can run the below script to get the excel's last updated time and then store into variable and show on dashboard.
SUB DoDir (Root)
FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'
FOR Each File in filelist (Root&'\*.' &Ext)
LOAD
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
Regards,
Kaushik Solanki
sounds good. i will try it
could you please expain how to use this script in my application.
Hi,
Use the same script in your application. Something like this.
SUB DoDir (Root)
FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'
FOR Each File in filelist (Root&'\*.' &Ext)
LOAD
TEST:
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
Let vDate = Peek('FileTime',0,'TEST');
Now the last updated datetime is in variable, you can use it where ever you want.
Note: I assume that the TEST table will have only 1 record (for the file you want.)
Regards,
Kaushik Solanki