Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

alexandergrando
New 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
Contributor

Re: Clear All On Open Trigger Bug?

Hi Alexander,

Try this:

=max( {1} CalendarYear)

8 Replies
juan_patrick
Contributor

Re: Clear All On Open Trigger Bug?

Hi Alexander,

Try this:

=max( {1} CalendarYear)

alexandergrando
New Contributor III

Re: Clear All On Open Trigger Bug?

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
Contributor

Re: Clear All On Open Trigger Bug?

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 )

Highlighted
atkinsow
Valued Contributor II

Re: Clear All On Open Trigger Bug?

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
New Contributor III

Re: Clear All On Open Trigger Bug?

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
New Contributor III

Re: Clear All On Open Trigger Bug?

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
New Contributor III

Re: Clear All On Open Trigger Bug?

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.

atkinsow
Valued Contributor II

Re: Clear All On Open Trigger Bug?

Second action on CalendarMonthName for Select in Field.

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