Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Time since Macro has run

Hi there,

Im aware you can create a text box to display the time since a report has been Reloaded, is it possible to display the time a Macro was last run?

Many Thanks

Gerard

2 Replies
Highlighted
Not applicable

Time since Macro has run

Within the macro you could output the date/time to a file that gets loaded by the script. If you append to the file then use 'max' to get the most recent.

This is some macro code I use to record when some data is exported, which should give you some ideas:

set doc=ActiveDocument

vExportLog = doc.Variables("vExportLog").GetContent.String ' get log name

set fso = CreateObject("Scripting.FileSystemObject")

on error resume next

set logFile = fso.GetFile(vExportLog)

if err <> 0 then ' file does not exist
on error goto 0
set logFile = fso.CreateTextFile(vExportLog)
set logFile = fso.GetFile(vExportLog)
else
on error goto 0
end if

set txsStream = logFile.OpenAsTextStream(8) ' append
txsStream.WriteLine Now & " " & vExportTo & " created by " & doc.GetProperties.FileName
txsStream.WriteLine Now & " " & vExportTo_1 & " created by " & doc.GetProperties.FileName
txsStream.Close

Regards,

Gordon

Highlighted
MVP
MVP

Time since Macro has run

I'd think you'd just set a variable to now() in the macro or as a separate action along with the macro trigger. The time since the macro was last run is interval(Variable-now()). But yeah, if you want that number preserved even when exiting and reentering the application, you'd probably need to fiddle with something like Gordon suggests.