<?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 default time frame - VB help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164897#M37422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to be careful with the Search String it appears to be very picky. In your string you had: double-quote space greater-than space (" &amp;gt; Add...). I had to remove those spaces to get it to work. I also made some modifications that got this to work on a date field in my data set. The expression is returning a date, so if your date fields are really just strings, you may need to modify it further to get it working.&lt;/P&gt;&lt;P&gt;Here's what I used:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;='&amp;gt;$(=AddMonths(date(Today(),YYYYMM) ,-4))'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The equals sign is needed to start. I usually stick with single-quotes (don't know if that is required). You also don't need the single quotes around the date format since it is embedded in another set of quotes. Finally, I used a dollar sign expansion to force the AddMonths function to evaluate before performing the search. I don't know if all of those changes are required, but it worked on a date field in one of my applications.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Jan 2011 16:57:44 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-01-13T16:57:44Z</dc:date>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164892#M37417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;my requirement is to show the last 3 months of data by default (on opening the document and on some sheets).&lt;/P&gt;&lt;P&gt;I think the way to do this is by writting a macro to pull data where FiscalMonth &amp;gt;= today() - 4 ....roughly, and set that up as an Action in the Sheet Properties.&lt;/P&gt;&lt;P&gt;Could someone help me with the VB syntax for this? Unless there is a better way to do this without writting a macro.&lt;/P&gt;&lt;P&gt;The FiscalMonth field is in the following format: 200901, 200901, 200903...&lt;/P&gt;&lt;P&gt;Thanks, Maria&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jan 2011 21:15:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164892#M37417</guid>
      <dc:creator />
      <dc:date>2011-01-11T21:15:40Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164893#M37418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set Analysis would probably be preferred. Something like:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum({&amp;lt;FiscalMonth&amp;gt;={($=Today()-4)}&amp;gt;} Sales)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;You'll probably need to adjust that a bit depending on your data formats. Regardless of the formats, Set Analysis should be able to solve the problem. &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The second best way is with Actions. Actions allow macro functionality without requiring you to write VB code. This can be done using a Select Action in the OnOpen event of the document. Search string would be similar to the expression you posted.&lt;/P&gt;&lt;P&gt;The final method would be the macro. You would use ActiveDocument.Fields('FieldName').Select 'SEARCH STRING' and use the same search string from the Action.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jan 2011 21:27:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164893#M37418</guid>
      <dc:creator />
      <dc:date>2011-01-11T21:27:50Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164894#M37419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maria,&lt;/P&gt;&lt;P&gt;I'd rather take you back to your earlier idea of selecting dates using special choices like "Last 3 Months", "Last 6 Months", etc... If you create such a field in your calendar, your job will be as simple as adding an Action on each required sheet and selecting a field value "Last 3 Months". QlikView will do the rest, and the user will be able to modify the selection when needed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jan 2011 21:33:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164894#M37419</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-01-11T21:33:12Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164895#M37420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;NMiller,&lt;/P&gt;&lt;P&gt;I think option 2 would be best. Unfortunately, I am having a hard time with that syntax as well.&lt;/P&gt;&lt;P&gt;This is what I am doing in the Search String but it doesn't work. [Fiscal Month] is a field loaded in the script with no date formatting, and has the following values: 201010, 201011, 201012....Any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;date([Fiscal Month],'YYYYMM') &amp;gt; AddMonths(date(Today(),'YYYYMM') ,-4)&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Maria&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 21:36:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164895#M37420</guid>
      <dc:creator />
      <dc:date>2011-01-12T21:36:51Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164896#M37421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oleg,&lt;/P&gt;&lt;P&gt;yes, that works. I am doing the following in the script, and then I set up an Action at the Document level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;if (date#(FISCAL_MONTH,'YYYYMM') &amp;gt; AddMonths(date(Today(),'YYYYMM') ,-4),'Last 3 Months') as [Time Grouping]&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I am just curious how this would work with NMiller's suggestion.....I tried typing " &amp;gt; AddMonths(date(Today(),'YYYYMM') ,-4)" in the String Seach box, but it doesn't seem to work.&lt;/P&gt;&lt;P&gt;Thanks, Maria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jan 2011 23:08:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164896#M37421</guid>
      <dc:creator />
      <dc:date>2011-01-12T23:08:41Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164897#M37422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to be careful with the Search String it appears to be very picky. In your string you had: double-quote space greater-than space (" &amp;gt; Add...). I had to remove those spaces to get it to work. I also made some modifications that got this to work on a date field in my data set. The expression is returning a date, so if your date fields are really just strings, you may need to modify it further to get it working.&lt;/P&gt;&lt;P&gt;Here's what I used:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;='&amp;gt;$(=AddMonths(date(Today(),YYYYMM) ,-4))'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The equals sign is needed to start. I usually stick with single-quotes (don't know if that is required). You also don't need the single quotes around the date format since it is embedded in another set of quotes. Finally, I used a dollar sign expansion to force the AddMonths function to evaluate before performing the search. I don't know if all of those changes are required, but it worked on a date field in one of my applications.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jan 2011 16:57:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164897#M37422</guid>
      <dc:creator />
      <dc:date>2011-01-13T16:57:44Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164898#M37423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maria,&lt;/P&gt;&lt;P&gt;if it still does not work after the last correction from NMiller, try formatting the date after applying AddMonths, and not before. The function AddMonths() returns a date field, and it might have to be formatted as well...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV id="refHTML"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 21:43:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164898#M37423</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-01-14T21:43:17Z</dc:date>
    </item>
    <item>
      <title>default time frame - VB help</title>
      <link>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164899#M37424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="background-color:#ffffff;margin:8px;font-family:Arial, Helvetica, sans-serif;color:#000000;font-size:12px;background-origin:initial;background-clip:initial;"&gt;&lt;P&gt;Maria,&lt;/P&gt;&lt;P&gt;Another approach is to make all your initial selections using search expressions. Then save as a bookmark and apply the bookmark as your Action. See attached for an example.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 23:42:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/default-time-frame-VB-help/m-p/164899#M37424</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-01-14T23:42:12Z</dc:date>
    </item>
  </channel>
</rss>

