Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
marksmunich
Creator III
Creator III

inserting the timestamp of data source in qv application

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

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

8 Replies
marksmunich
Creator III
Creator III
Author

this displays the last reload of the application. but i want to get the timestamp of the excel file. which is my source data.

Not applicable

So you wanna display when the excel file was created?

Not applicable

SET vTIMEStart = Now(); //When extraction Start

SET vTIMEEnd = Now(); //When extraction End

Inline:
    
LOAD * Inline [
           StartTime,EndTime
           $(
vTIMEStart),$(vTIMEEnd)];

marksmunich
Creator III
Creator III
Author

i want to display when the excel was last updated (it is same as when it is created)

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
marksmunich
Creator III
Creator III
Author

sounds good. i will try it

marksmunich
Creator III
Creator III
Author

could you please expain how to use this script in my application.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!