Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
C4ppy
Contributor
Contributor

Issue when using bookmark navigation

Hi all,

I'm trying to implement a user friendly-navigation pattern using a combination of buttons and bookmarks but I'm running into some strange issues I cannot explain.

When loading the application I create a variable vOffset which is initialized to 0.

SET vOffset = 0;

The application has a default bookmark with a dynamic filter that uses the variable defined when loading the application data:

{<BudgetYear={"=BudgetYear=Year(AddYears(Today(), vOffset))"}>}

When the application is opened, the default bookmark sets the BudgetYear to 2022 as expected. As you can see in the screenshot, the value of vOffset is correctly initialized to 0.

C4ppy_0-1652782038496.png

Till this point all is going well. In order to provide easy navigation for the end-user, I also added 2 buttons to navigate over the different budget years.

Both buttons contain 2 actions:

  • The first action manipulates the value of vOffset (-1 or +1 depending on the button)
  • The second action applies the BudgetYear bookmark

The idea is that when clicking the back-button while the year is 2022, the value of vOffset is set to -1 and the bookmark is re-applied causing the filter to change into 2021.

However, when clicking the button, the filter is cleared and all data is shown. Setting the value of vOffset has succeeded as indicated in the KPI control in the application.

C4ppy_1-1652782334024.png

But it becomes even stranger. If you click the back-navigation a second time, the value of vOffset changes to -2 and the filter is applied correctly.

C4ppy_2-1652782444782.png

So basically, the navigation buttons are working every second time you click them. In the other case the filter is cleared.

Does anyone have a pointer to what may cause this strange behavior.

 

Thanks in advance,

Erwin

Labels (1)
1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

Set your BudgetYear field expression to this and then create your bookmark.  I tested and it works.

 

=only({1} BudgetYear)=Year(AddYears(Today(), vOffset))

View solution in original post

3 Replies
stevejoyce
Specialist II
Specialist II

Set your BudgetYear field expression to this and then create your bookmark.  I tested and it works.

 

=only({1} BudgetYear)=Year(AddYears(Today(), vOffset))

C4ppy
Contributor
Contributor
Author

Thanks for the quick response!
Can you by any chance explain what I did wrong?

stevejoyce
Specialist II
Specialist II

i think its just a caveat to dynamic bookmark/expression.  if BudgetYear is set to 2021 already, and you are trying to set it to say 2022, just BudgetYear=2022 is going to return null so it clears the selection.  Then since your field is cleared the next action works.  

When your field already has a selectiona nd you want to change it, using {1} makes sure it already isn't filtered.