Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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 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.
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.
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
Set your BudgetYear field expression to this and then create your bookmark. I tested and it works.
=only({1} BudgetYear)=Year(AddYears(Today(), vOffset))
Set your BudgetYear field expression to this and then create your bookmark. I tested and it works.
=only({1} BudgetYear)=Year(AddYears(Today(), vOffset))
Thanks for the quick response!
Can you by any chance explain what I did wrong?
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.