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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro vbscript to set range between day 1 and today

I would like to select records starting from the 1st day of the month to the current day of the month.
My first attempt:
Sub firstSel
Set q = ActiveDocument
q.ClearAll (True)
Set f1=q.GetField("AV_FLOW_YEAR")
f1.select("2011")
Set f2=q.GetField("AV_FLOW_MONTH")
f2.select("09")
Set f3=q.GetField("DAY")
f3.select(">=1 <=today()")
'would like to set range to be >=1 <=today()
End sub
However, today is not a value in vbScript
Have tried datepart, to no avail
James
1 Solution

Accepted Solutions
Not applicable
Author

Sub firstSel
Set q = ActiveDocument
q.ClearAll (True)
Set f1=q.GetField("AV_FLOW_YEAR")
f1.select("2011")
Set f2=q.GetField("AV_FLOW_MONTH")
f2.select("09")
Set f3=q.GetField("DAY")
f3.select(">=1 <="&datepart("d",now()))
'would like to set range to be >=1 <=today()
End sub

Looks like I found the answer, by using the & to append the value to the string expression used for the search criteria

View solution in original post

1 Reply
Not applicable
Author

Sub firstSel
Set q = ActiveDocument
q.ClearAll (True)
Set f1=q.GetField("AV_FLOW_YEAR")
f1.select("2011")
Set f2=q.GetField("AV_FLOW_MONTH")
f2.select("09")
Set f3=q.GetField("DAY")
f3.select(">=1 <="&datepart("d",now()))
'would like to set range to be >=1 <=today()
End sub

Looks like I found the answer, by using the & to append the value to the string expression used for the search criteria