Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
paul_scotchford
Specialist
Specialist

Using a trigger to get a Min(CalendarDate)

Hi All

I am unable to get the below scenario to work ...

Config : QlikView Server 11.2 SR5 on a Win 2012 box

            1: Date Dimension of Years, Months, Dates

            2: OnSelect Action on the Years Dimension

Scenario:

          User selects the Year e.g. 2013

Requirement:

          OnSelect trigger to Set Variable with a search string = Min(CalendarDate)

Expected Result:

          variable should now have the Min Date of the selected year e.g. '1st Jan 2013' value

Result:

        

          The variable does not change!

I know the trigger works as I can use a literal and plug it into the variable, I thought though that I would be ok using the Min() function to get the start date of the Year selected.

Clearly I am missing something or its just not supported by QV?

Thanks in advance

Paul

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

You don't need a trigger for this. Just set the variable to '=Min(CalendarDate)' including the equal sign, and then it will recalculate automatically every time you make a selection.

HIC

View solution in original post

6 Replies
Not applicable

Hi Paul,

You can use the function MonthStart function to obtain the date that you want.

For example: MonthStart(MakeDate("here obtain the value of the selection*")

* You can use, max(year), min(year), getfieldselections(year), only(year)

MonthStart return a date with the first day of the month, and makedate generates a date with the values that you specified for the year, month and day for example MakeDate (2013,12,08)  -- Year, Month, Day

Regards.

chiru_thota
Specialist
Specialist

It should work for sure.Have you tried any other trigger in the same applications ?

min date in year.jpg

paul_scotchford
Specialist
Specialist
Author

Thanks Chiranjeevi,

This is how I Implemented it as detailed in my question, it does not work unfortunately, hence my post

cheers

maxgro
MVP
MVP

see attachment

the trigger on select of field year is set variable with expression

=date(min(CalendarDate), 'DD MMM YYYY')

if you want to set the variable also when you select in different calendar fields (date field, ....), use  the on select trigger

hic
Former Employee
Former Employee

You don't need a trigger for this. Just set the variable to '=Min(CalendarDate)' including the equal sign, and then it will recalculate automatically every time you make a selection.

HIC

paul_scotchford
Specialist
Specialist
Author

Thanks Henric, that makes sense when I think about it, I will test this on Monday when I'm back in the office .