Forum

This content is now out of date.

Visit Our Community

Date Filters to have values default to the last month, month prior to it and two month prior

Hi,
We are using YF6.1. We have a requirement where there are 3 sets of date filter sets -
1. 1st set defaults to last month beginning and end respectively. But the user can select his own values
2. 2nd set defaults to month before last month start and end respectively. Again the user has the flexibility to choose his own dates.
3. Similarly the 3rd set defaults to month start and end dates of the month prior to that with flexibility for the user to choose his dates.

We have done a workaround in 5.2 by having 2 sets for each date range, with the omit button. One set will be for default values and another set for user selection. Based on the user choice, he will omit one set or the other. Attached is a screenshot.
We will would like to know if in v6.1, there is any way by which we can use the same filter set for custom default values and custom user selectable values. This may be possible for previous month start and end dates where we can use the predefined date period - 'Previous month start date' and 'Previous month end date' as default values. But ow do we do this for the other 2 prior months?
Hi,

yes it's possible, set one filter equal to 3 months ago, and the other one equal to user prompt (with the Allow Omit option), that way if the user doesn't enter a value the filter will use the default values, otherwise it will use the user input.
In this example the data is:

StopNum BoardingTime Passengers
1 2012-04-02 11:25:40.610 1
2 2012-04-03 11:25:40.610 2
6 2012-04-21 09:31:08.700 3
8 2012-04-22 12:31:08.700 4
10 2012-04-23 01:05:00.000 5
3 2012-04-24 01:30:23.380 6
22 2012-04-25 09:31:08.700 7
7 2012-04-26 09:31:08.700 8

1) one filter has user prompt and the other has default values:

Forum image

2) now if the user doesn't enter any input it uses the default values:

Forum image

3) or if the user enters the values that are a subset of the default ones then those will be used:

Forum image


I hope that's what you're after.

Regards,
David
Thanks for your response.
We have done a similar approach currently. But the challenge is that the default dates should change dynamically month on month.
FOr eg. If the current month is June, then the previous 3 months default should be May, April and March. If the current month is July, then the previous 3 months default should be June, May, April. Apart from this there will be a user enterable date range. We are able to use 2 filter sets and achieve as we had done that in the past.
The problem is
1. how to default the month begin and end values dynamically when the current month changes AND
2. let the user select a custom date range in the same filter set that had default values set.

The previous attachment will show the method we had done - 2 filter sets. We would like to know if it (dynamic default values and user selection) can be done in a single filter set.
Hi Pankaj,

YF can do half the challenge, i.e. the dynamic default values. Here's how to do it, set your Filter to use the Between operator, then select Filters->Entry Style->Custom Query:

Forum image

then add your SQL code that gives you (NOW - x months):

Forum image

refresh your cached filter and select the Default values:

Forum image


Forum image


For the user selection part of your challenge you will have to stick with the way you are currently doing it as YF doesn't allow you to have this option in the same filter.

Regards,
David