Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
alexandergrando
Contributor III
Contributor III

Clear All On Open Trigger Bug?

Hello,

I am trying to have my document automatically select the max calendar year on open. I am trying to use document triggers to accomplish this. My first trigger is a Clear All. The next trigger is: =max(CalendarYear). Please see screenshot below.

Screenshot.PNG

The problem is that I only get the correct max year if no year was selected in the prior save. Otherwise, the year will show up as the one last saved despite the Clear All trigger and the Select in Field trigger.

Can anyone please help? Is this a bug?

Message was edited by: Alexander Grando Reason: Attached sample app.

1 Solution

Accepted Solutions
juan_patrick
Creator
Creator

Hi Alexander,

Try this:

=max( {1} CalendarYear)

View solution in original post

8 Replies
juan_patrick
Creator
Creator

Hi Alexander,

Try this:

=max( {1} CalendarYear)

alexandergrando
Contributor III
Contributor III
Author

Hi Juan,

Thanks for the response. Your expression works.

I also need to select the max MonthName in addition to the year. I tried including an additional Select in Field trigger with an alteration of your expression, but it didn't work.

Do you suppose you can help me out with this also? Thanks.

juan_patrick
Creator
Creator

Alexander,

You can create a Flag in script for max year & month, and in the trigger you use only this field (the flag).

Or you can try this:

=max( {1<CalendarYear={"=$(=max({1}CalendarYear))"} >} monthnamefield )

Anonymous
Not applicable

If possible I would create a field in my data model that is a date for the first of the month.  Then all you have to do is 1 trigger like

=max({1} MonthDate)

alexandergrando
Contributor III
Contributor III
Author

Juan,


I tried your new expression, but was unable to get it to work. I am attaching a sample app. Can you please show me how to set up the flag field? I am also OK with any other method to get this to work.

alexandergrando
Contributor III
Contributor III
Author

Hi Wallo,

I actually already have a single field that I can use to get the max date. But the reason I want to do one separately for year and another for month is to bring attention to the listboxes via the the green highlight color. Otherwise, they are only colored white if indirectly selected. Please have a look at my app above if you want.

alexandergrando
Contributor III
Contributor III
Author

Hi,

I just want to bump this thread because it has been several days since I've received a reply and my question remains unanswered.

Anonymous
Not applicable

Second action on CalendarMonthName for Select in Field.

=Month(MakeDate(max({1}CalendarYear), max({1<CalendarYear={'$(=max({1}CalendarYear))'}>}CalendarMonthName), 1))