<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dates selected automatically in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146105#M24712</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, month(today()-1) is the month of the yesterday day, that in most cases is the same as today's month, unless today is the 1st of a month.&lt;BR /&gt;To go back one month, you can use AddMonths(today(), -1). So, in macro:&lt;BR /&gt;ActiveDocument.Evaluate("month(AddMonths(today(), -1))")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2009 09:32:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-07-01T09:32:09Z</dc:date>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146097#M24704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings-&lt;/P&gt;&lt;P&gt;I am wondering if anyone has had any luck using a macro or something else that knows that you are in 2009 or (Current Year) and that the month should be thru today. Thus when the app opens it should select 2009 (since we are presently in the year) as the year and Jan - Jun as the Month range.&lt;/P&gt;&lt;P&gt;Obviously as the year goes on it will know to select more dates based on today's date.&lt;/P&gt;&lt;P&gt;Currently we are saving the date range so when it is sent out via publisher, the date range is there; However this is not automatic and relies on someone every month changing the date range...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas? Tips? Suggestions&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 19:53:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146097#M24704</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-06-05T19:53:24Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146098#M24705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For your macro, you're going to want to create an OnOpen sub. Go to the Macros tab under Document Properties and there you can set OnOpen to one of your subroutines. This sub will obviously run when the document is opened.&lt;/P&gt;&lt;P&gt;There are multiple ways to get the current date in a QlikView macro. There is a good discussion of the different methods in this thread: &lt;A href="http://community.qlik.com/forums/t/16651.aspx"&gt;http://community.qlik.com/forums/t/16651.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In your sub, you're going to need to pull the current date using one of the above methods. Then you want to use&lt;/P&gt;&lt;P&gt;ActiveDocument.Fields("FIELD_NAME").Select 'Selection'&lt;/P&gt;&lt;P&gt;to make selections on your fields. For year, it's going to be a single selection. The months will be a little more complicated as you'll need to define a range. The specifics will depend on how your data is laid out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 21:30:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146098#M24705</guid>
      <dc:creator />
      <dc:date>2009-06-05T21:30:00Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146099#M24706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or, you can do it on the Date level, so the year and month will be indirectly selected automatically:&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sub OnOpen&lt;BR /&gt; set d=ActiveDocument.Fields("Date")&lt;BR /&gt; d.Select "&amp;gt;=" &amp;amp; ActiveDocument.Evaluate("YearStart(today())") &amp;amp; "&amp;lt;=" &amp;amp; ActiveDocument.Evaluate("today()")&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 22:08:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146099#M24706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-05T22:08:45Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146100#M24707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I was writing my reply, I wondered about the best way to select a range of dates. I think Michael's suggestion is the way to go. It makes the Selection cleaner (and you only have to make one).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2009 22:16:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146100#M24707</guid>
      <dc:creator />
      <dc:date>2009-06-05T22:16:44Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146101#M24708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael, that is nice!&lt;/P&gt;&lt;P&gt;But is there a way for it to actually Select the Year and The months in that Select statement? As of now this is what it looks like &amp;gt;=1/1/2009 &amp;lt;=6/5/2009&lt;/P&gt;&lt;P&gt;I was thinking it would be year 2009 and Months Jan, Feb, mar, Apr, May, Jun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2009 00:41:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146101#M24708</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-06-06T00:41:56Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146102#M24709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wanted to make your life easier... &lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt; OK&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sub OnOpen&lt;BR /&gt; set y=ActiveDocument.Fields("Year")&lt;BR /&gt; set m=ActiveDocument.Fields("Month")&lt;BR /&gt; y.Select ActiveDocument.Evaluate("Year(today())")&lt;BR /&gt; m.Select "&amp;gt;= 1" &amp;amp; "&amp;lt;=" &amp;amp; ActiveDocument.Evaluate("num(month(today()))")&lt;BR /&gt;end sub&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2009 00:53:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146102#M24709</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-06T00:53:39Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146103#M24710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PERFECTO!&lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2009 00:58:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146103#M24710</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-06-06T00:58:02Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146104#M24711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Micahel, I tried ACtiveDocument.Evaluate("Month(today())-1"), yet it wont work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want it to know that based on todays date, i.e. June, go back 1 month&lt;/P&gt;&lt;P&gt;I can write that same thing in the UI, but in the Macro it doesnt work...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 09:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146104#M24711</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-07-01T09:04:18Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146105#M24712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, month(today()-1) is the month of the yesterday day, that in most cases is the same as today's month, unless today is the 1st of a month.&lt;BR /&gt;To go back one month, you can use AddMonths(today(), -1). So, in macro:&lt;BR /&gt;ActiveDocument.Evaluate("month(AddMonths(today(), -1))")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 09:32:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146105#M24712</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-01T09:32:09Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146106#M24713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael, I was thinking and have been stumped on this, &lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;sub&lt;/B&gt; StartDate&lt;/P&gt;&lt;P&gt;&lt;B&gt;set&lt;/B&gt; y=ActiveDocument.Fields("Year")&lt;/P&gt;&lt;P&gt;&lt;B&gt;set&lt;/B&gt; m=ActiveDocument.Fields("Month")&lt;/P&gt;&lt;P&gt;&lt;B&gt;Select&lt;/B&gt; ActiveDocument.Evaluate("Year(today())")&lt;/P&gt;&lt;P&gt;&lt;B&gt;Select&lt;/B&gt; "&amp;gt;= 1" &amp;amp; "&amp;lt;" &amp;amp; ActiveDocument.Evaluate("num(month(today()))")&lt;/P&gt;&lt;P&gt;&lt;B&gt;end&lt;/B&gt; &lt;B&gt;sub&lt;/B&gt;&lt;/P&gt;&lt;P&gt;how can I throw in an If statement onto this to tell it if the Month is January, go back one year and select all months or else do as is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 05:56:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146106#M24713</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-07-30T05:56:49Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146107#M24714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use "if":&lt;BR /&gt;if &amp;lt;condition here&amp;gt; then&lt;BR /&gt; &amp;lt;your actions if condition is true&amp;gt;&lt;BR /&gt;else&lt;BR /&gt; &amp;lt;your actions if condition is false&amp;gt;&lt;BR /&gt;end if&lt;BR /&gt;I can't tell more because it's not exactly clear waht is your condition "the Month is January" (current Month? selected Month?), and what is "go back one year and select all months". Hope you can figure out from here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 06:46:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146107#M24714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-30T06:46:51Z</dc:date>
    </item>
    <item>
      <title>Dates selected automatically</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146108#M24715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michel, I was thinking thta based on todays date, it would evaluet the month and if todays date was in January, it would go back 1 year and select that year and all 12 months or else it would do the normal routine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2009 08:30:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-selected-automatically/m-p/146108#M24715</guid>
      <dc:creator>james</dc:creator>
      <dc:date>2009-07-30T08:30:43Z</dc:date>
    </item>
  </channel>
</rss>

