Page 1 of 1

Default values for filters

PostPosted: Wed Jan 06, 2010 9:16 pm
by Bob Cergol
I've searched every entry in the documentation for the word "default" to see if I can set the default values on filters -- particularly on date fields.

It seems this is only possible for data entry.

Yes, the user-selected values are retained -- but only for the logged-in session. At the next log in they revert to "*".

I'm thinking there is probably a way to do this -- just not via the pre-defined design list options.

Example: I want various order reports to default to the current year when they get executed. Even if I set them to display the first page blank, its still desirable to have some of the date fields default to expected values and not require the user to select them unless they want different values.

Bob

P.S. I've been smiling all day as I am working with DAI as it gives me great pleasure to see the results each time I try something new I've learned. I feel like a kid visiting an amusement park for the first time!

Re: Default values for filters

PostPosted: Wed Jan 06, 2010 9:18 pm
by Bob Cergol
Just to be clear. I have used alias values, but I'm under the impression that those are only for enforced filters.
Bob

Re: Default values for filters

PostPosted: Thu Jan 07, 2010 6:59 am
by Carsten Sørensen
Hi Bob,

You are not the first to ask this question - I guess its time that we provide a filter default option!

The reason we haven't is that we usually solve the "newest year" or "latest booking date" issues by creating a SELECT combo on the column and sort the COMBO Z-A. The benefit of that approach is that you get the correct date on a Monday with the latest booking date eventually being the Friday (and not just the day before etc.). If you set the REQUIRED option on such a COMBO it will automatically select the first item if no user session variables are available.

We will put your request on the list.

P.S. You make me smile! The best reward when developing Dynamic AI is to get such feedback!!

Best regards
Carsten

Re: Default values for filters

PostPosted: Thu Jan 07, 2010 3:26 pm
by Bob Cergol
Hi Carsten,

Thanks for that tip. The technique of making the combo required and sorting Z-A does just what I want for my "year" selection. (Except, with the "required" setting, I can no longer use a "select multiple". DAI treats it as a "select".)

It also works for booking date, but in my case the orders are not partitioned -- there are 3 years worth in my view, so the combo list AI generates exceeds the 500 default maximum setting. It would be better for the user to get a calendar to select a different date instead of a combo.

In addition to being able to set literals as a default filter value, a function such as GetDate() would be desirable.

I wonder if maybe a shortcut for implementing this feature would be:

1) add a checkbox for alias# values that specifies whether they will be enforced or not.
2) allow the use of functions as the alias value --- hmmm... could an alias value be made to execute an really simple SQL statement like "select [entdate] from jcjobs where [entdate] = GetDate()" and then just return the first value as the one to use for the alias#

By the way, I don't understand how DAI & SQL can so instantaneously generate a combo for the years that appear in my orders table. There are tens of thousands of records spanning 4 years. It must be jumping in and out of an index for which the date is the first segment -- yes?

Bob

Re: Default values for filters

PostPosted: Thu Jan 07, 2010 4:01 pm
by Carsten Sørensen
Hi Bob,

I'm not 100% sure where you would put the non-enforced alias - if you would put it in Free SQL Where - then you can already do it like:

orderdate.jpg
orderdate.jpg (68.07 KiB) Viewed 10027 times


Where you can also use GetDate() / Now and stuff like that. However that would be a fixed condition that the user can't change during execution of the report.

There is an option for using @DATE as a default parameter for a filter - but that involves using Dynamic AI SQL views and @PAR variables - I don't think that is the right way - but it is a way...

I rather look into providing a proper default Filter function and in the meantime you'll have to live with the date-popup - at least you don't have to enter the date then! :-)

Best regards,
Carsten

Re: Default values for filters

PostPosted: Sun Jan 10, 2010 6:58 pm
by Carsten Sørensen
Hi,

We have a lot of new default functions available for filters for the next release.

mostdefaults.jpg
mostdefaults.jpg (213.88 KiB) Viewed 10023 times


the definition:
listoptions1.jpg
listoptions1.jpg (337.3 KiB) Viewed 10023 times


listoptions2.jpg
listoptions2.jpg (316.62 KiB) Viewed 10023 times


Will be released soon.

Best regards,
Carsten

Re: Default values for filters

PostPosted: Mon Jan 11, 2010 9:06 pm
by Bob Cergol
Outstanding!
Thanks for adding another magic arrow to the golden quiver!
Bob