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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to assign dynamic datetime field values to a variable in a Macro ?

I would like to assign a dynamic datetime field values to variables but do not know how to do this (specifically the QV syntax used in the expression) in a macro.

I have 2 variables, "vFromDate" and "vToDate" and would like to assign the values as below

vFromDate = timestamp(daystart(min([Delivery Date (PDT)])),'M/D/YYYY h:mm:ss TT')

vToDate = timestamp(dayend(max([Delivery Date (PDT)])),'M/D/YYYY h:mm:ss TT')

I understand that you can set a variable by using the "Set Variable" action. However I would like to find a way to do this inside a macro.

Any help is appreciated.

1 Reply
Anonymous
Not applicable
Author

Hey Anthony,

I'm thinking this should work:

set v = ActiveDocument.GetVariable("vFromDate")

v.SetContent activedocument.Evaluate("timestamp(daystart(min([Delivery Date (PDT)])),'M/D/YYYY h:mm:ss TT')"),true

I haven't tested it out though so you might have to play around with it a bit.