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: 
Oliver_GER
Partner - Contributor II
Partner - Contributor II

Dynamic Bookmark not working with existing selections

Hi,

in the Datamodel I do have:

 

Data:
load * inline [
Year
2023
2024
2025
];

 

 

Then I filter for this

 

=Year=year(today())

 

 

After this I create a bookmark.

Now there are two scenarios

1) No filter is active and I apply the bookmark. ==> Result: 2024 is selected.

2) Filter is set to 2023 and I apply the bookmark ==> Result: Filter is removed, but 2024 is *not* selected.

 

Is there a workaround for this?

 

Labels (1)
2 Solutions

Accepted Solutions
lennart_mo
Creator
Creator

Using the following filter worked for me:

={1}Year=year(today())

 

View solution in original post

lennart_mo
Creator
Creator

Hi @Oliver_GER,

I think you need to evaluate the search string because Qlik only uses actual search values when 'Always one selected value' is enabled, so it should work using something like this:

={1}Year=$(=Only({1<User = {$(=subfield(osuser(),'=',-1))} >} DefaultYear))

It's important that you create the bookmark before enabling 'Always one selected value', since doing so afterwards will only save the value itself and not the evaluated string.

Let me know if this worked for you as well!

View solution in original post

6 Replies
marcus_sommer

You may try it with:

=year(today())
lennart_mo
Creator
Creator

Using the following filter worked for me:

={1}Year=year(today())

 

Oliver_GER
Partner - Contributor II
Partner - Contributor II
Author

Thanks, that worked!

I had tried something very similar before, but it did not work out:

=Year=year({1}today())

 

Now I have to adapt this to our current real-world problem. It does work, but only if the field is not set to "always one selected". I can't reproduce this issue with the year example, so I guess I will be able to solve this.

Oliver_GER
Partner - Contributor II
Partner - Contributor II
Author

hi @lennart_mo - Unfortunately I am able to reproduce the issue with the basic setup:

Year:
load * inline [
Year
2022
2023
2024
2025
];

DefaultYear:
load * inline [
User , DefaultYear
A	        ,	2022
yourOSUser	,	2023
C	        ,	2024
D	        ,	2025
];

Testing this expression:

only({<User = {$(=subfield(osuser(),'=',-1))} >} DefaultYear)

results in 2023 for my user. That is good.

Using this in a bookmark / filter works, but only as long as Year-field is *NOT* set to "allways one selected value.

={1}Year=only({1<User = {$(=subfield(osuser(),'=',-1))} >} DefaultYear)

Do you have any explanation, why this filter expressions works stops working once the field-setting is changed. And do you have any hint on how to solve this?

lennart_mo
Creator
Creator

Hi @Oliver_GER,

I think you need to evaluate the search string because Qlik only uses actual search values when 'Always one selected value' is enabled, so it should work using something like this:

={1}Year=$(=Only({1<User = {$(=subfield(osuser(),'=',-1))} >} DefaultYear))

It's important that you create the bookmark before enabling 'Always one selected value', since doing so afterwards will only save the value itself and not the evaluated string.

Let me know if this worked for you as well!

Oliver_GER
Partner - Contributor II
Partner - Contributor II
Author

Hi @lennart_mo ,

sorry for the late reply.

I have used your Filter statement and stored it into a bookmark *before* enabling *allways one value selected. This is the statement stored in the bookmark:

 

{<Year={"={1}Year=$(=Only({1<User = {$(=subfield(osuser(),'=',-1))} >} DefaultYear))"}>}

 

The bookmark works great when "allways one value selected" is disabled and continues working once it was enabled.

I will now test this in my actual envirnoment to see if this actually solves the issue.

Update: In my Real-world scenario it was a string and not a number. Therefore I had to add chr(39):

={1}Language=$(=chr(39) & Only({1<User = {$(=subfield(osuser(),'=',-1))} >} DefaultLanguage) & chr(39))

This works for me! Thank you very, very much!