Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Partner
Partner

Variable Constraint enforcement on Calendar Objects vs Input boxes

Hello Everybody,

I'm having an issue and I think I am just looking for a shoulder to cry on and confirmation that I am not crazy for expecting this to work a certain way.

Here is what I am trying to do.(I am on QV10 SR4)

I have a conformed calendar dimension and my users don't always like to use the YQM list boxes to get the data they want. They would like to be able to enter a date range and show activity for the range. I thought this was a reasonable request so I set out to build a prototype.

I have two variables shown in Calendar objects. The user may select any date within the range of the calendar table and I am able to use triggers on the variable to set the selection on the date field to the date range defined in the variables.

The Part that has me concerned is when I enter an end date that is less than the begin that the range selection is no longer a date span but rather the top and bottom of the table with a gap in the middle. This does not seem like the selection behavior I was expecting, when I enter >=1/1/2010<=12/31/2010 I get a range but when I enter >=12/31/2010<=1/1/2010 I get all but those between my two dates. This is weird behavior but I can live with it.

To solve the problem I decided to set some constraints on the variables so the Start Date may only be Less than or equal to the End Date and vice versa. I thought this would be a simple fix but the Calendar object will not evaluate the constraint I had set on the variable.

I have attached a sample, you can see when you change the value of the start or end date  using the Calendar Selectors then the contraints are not evaluated but if you change them using the input box then the constraints are enforced.

Suggestions for work arounds or corfirmations that I am insane are welcome.

Thanks

Chris

5 Replies
MVP
MVP

Re: Variable Constraint enforcement on Calendar Objects vs Input boxes

I'd just flip the dates around if required:

='>=' & '$(=date(rangemin(vStartDate,vEndDate)))' & '<=' & '$(=date(rangemax(vStartDate,vEndDate)))'

MVP & Luminary
MVP & Luminary

Re: Variable Constraint enforcement on Calendar Objects vs Input boxes

While not an answer to your question about applying constraints on the the calendar, I can give some pointers on applying constraints to the input box dates. There is a complete example "User selectable dates using Input Box" in the QV Cookbook. The constraints test that the input:

    - can be converted to a QV Date,

    - Start Date is less than End Date.

    - date is within range of available dates

-Rob

http://robwunderlich.com

Partner
Partner

Re: Variable Constraint enforcement on Calendar Objects vs Input boxes

Thanks John,

I had not thought of swapping the begin and end dates if they are selected incorrectly, but I fear this would cause more confusion than it resolves.

Honestly I'm completely floored that Qlikview will evaluate contraints when setting the value in an input box but not in the calendar object.

Thanks Rob, although I did not have trouble setting the actual constraint I appreciate the reply.

Chris

MVP & Luminary
MVP & Luminary

Re: Variable Constraint enforcement on Calendar Objects vs Input boxes

Hi Chris,

The only reason I referred to the Cookbook example was because I thought  your constraints were incomplete. For example, your sample allowed input like 1/35/2011.

-Rob

kalyanamharish
New Contributor II

Re: Variable Constraint enforcement on Calendar Objects vs Input boxes

Hey Chris , I too have the same issue.
Did you get the solution for the above.