Dynamically swap between Default Calendars on selecting new Tab
I am relatively new to QlikView and would like to swap between Default Calendars dynamically when I select a new Tab without having to use Field Event Triggers. If I could use Variable Event Triggers, I would not have to define separate Field Event triggers for each different Calendar. I am afraid there is quite a lot to read here before I get to the problem. Either I have over-complicated things and someone will say "just press the Magic Calendar Button" (perhaps something perhaps not quite that simple) or that there is a simpler way than my approach. Any help would be much appreciated.
So far I have successfully:
Load Script
SET Date and Time formats
Created the Month and Day names
Created a Month Sort order based upon our Financial Year
Created the Master Calendars
Application
Created “”From” and “To” Calendar Objects using variables:
vStartDateRange
=Min({1} $(eStartDate))
=Max({1} $(eStartDate))
vEndDateRange
=vStartDateRange
=Max({1} $(eStartDate))
Created "OnActivate Sheet" Triggers
Date Name Label Prefix = lDatePrefix (e.g. "Gate ")
Date Name Expression Prefix = eDatePrefix (e.g. "Gate")
Date Name Abbreviation = DateAbbreviation (e.g. " Gt ")
Date Name Financial Year = eDateFY (e.g. ==eDatePrefix & ' FY')
Date Name Quarter = eDateQuarter (e.g. ==eDatePrefix & ' Quarter')
Date Name Month= eDateMonth(e.g. ==eDatePrefix & ' Month')
Date Name Start = eStartDate (e.g. "GateStartDate"). This is the date field I will filter on for this particular Tab.
Created List Boxes for Financial Year, Quarter and Month Using Expressions to identify the Fields
[$(eDateFY)]to identify the Field as [Gate FY]
[$(eDateQuarter)]to identify the Field as [Gate Quarter]
[$(eDateMonth)]to identify the Field as [GateMonth]
Others that just clear eDateFY, eDateQuarter and eDateMonth fileds (e.g. Field: =eDateFY )
vEndDateRange (as above for the Start Date)
Here is the problem:
I have created Field Event Triggers for each of the Date Fields ([Gate FY], [Gate Quarter] and [Gate Month]). Is there a way that I could use Variable Event Triggers to replicate the actions of the Field Event Triggers shown below?
If these could be Variable Event Triggers, I wouldn't have to repeat the work every time I add a new Calendar. So, for example (I have done the same for FY, Quarter and Month):
For the Field [Gate FY] I have created:
OnSelect Field Event Triggers
Set Variable
Variable: vStartDateRange
Value: =minstring($(eStartDate))
Set Variable
Variable: vEndDateRange
Value: =maxstring($(eStartDate))
Clear Field
Field: ==eDateQuarter
OnChange Field Event Triggers (these are convoluted statements to reset the vStartDateRange and vEndDateRange Date Variables.
For example
=if((GetSelectedCount([$(eDateFY)])=0 and GetSelectedCount([$(eDateQuarter)])=0 and GetSelectedCount([$(eDateMonth)])=0), Minstring($(eStartDate)), if((GetS..............., nul()))))