Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

pre selecting multiple year in a sheet

Hi Guys,

I have multiple sheets. I have created a trigger that selects the latest year whenever a user clicks on a sheet.

However if this user selects multiple year, and goes back to that sheet, he still sees the latest year.

My question: how configure that a sheet is by default the latest year and if a user selects other years, QV holds these values.

Thanks!

Sam

1 Solution

Accepted Solutions
maxgro
MVP
MVP

trigger should be (y is the year field)

=If(GetSelectedCount(y) = 0, Max({1}y), '(' & Concat(DISTINCT y, '|') & ')')

View solution in original post

8 Replies
sunny_talwar

May be use a if statement in your trigger:

If(GetSelectedCount(Year) < 2, Max({1}Year))

avinashelite

to handle this you need to follow a two step process.

while setting the trigger you need to count the year selection made and set the variable using

on changes event and then in

on select you need to set the field value as well as the variable (setting the variable again is also important here ). Finally using the variable count you can set the field trigger

ankit777
Specialist
Specialist

May be set the trigger value like this:

if(getselectedcount(Year)=0,Max(Year))

maxgro
MVP
MVP

trigger should be (y is the year field)

=If(GetSelectedCount(y) = 0, Max({1}y), '(' & Concat(DISTINCT y, '|') & ')')

Anonymous
Not applicable
Author

It's not working.

This is what I have now on one sheet:

field               Year

search           =max(Year)

but If I go to the next sheet and select more than 1 year and go back to my first sheet, the max year is selected.

sunny_talwar

Try Massimo Grossi‌ solution and see if that works. If not, would you be able to share a sample?

buzzy996
Master II
Master II

try to use tis macro on ur document with triggers and see.

sub On_Load

  ActiveDocument.ClearAll

    ActiveDocument.Fields("Year").Select Year(Now())

end sub

maxgro
MVP
MVP

trigger in sheet6