

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
on demand workaround for varialble values not passed in
Hello,
Does anyone have a good workaround for on demand and variables not being passed in.
As an example in my dashboard I have a variable vUnitsDollars which is set to 0 for Units and 1 for dollars. In my expressions I use:
if(vUnitsDollars=0,sum(Units),sum(NetAmount)
I then have a variable switch where the user can select units or dollars. This works great in Qlik Sense but this is not passed into on demand.
I know I can use a data island but how do I create a toggle switch that will change the values of the data island and then pass this to the variables.
Thanks in advance.
Michael
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a follow up to your question about hiding selection - sure there is no issue with that, but there is a catch...
If you are going to use buttons like in my example with 2 blue buttons you have to configure them before you hide fields, because this object allows to configure only visible fields. To configure hidden fields you would have to edit object in Developer mode (aka with url suffix "/options/developer"
--> right click --> Developer and manually edit properties of such object) which may not be worth an effort.
So all what you do is configure objects while fields are still visible and when you are happy with results add that line to your script " TAG FIELDS UnitDollar WITH $hidden ;" and reload to hide field:
this is the result you would get - I dont know how to get rid of "hidden selection applied" message though, I reckon it needs to stay there:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
regarding hiding fields - yes - there are multiple methods:
or
or mention earlier:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correct & Correct, that is exactly how it works.
cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
what do you mean by saying: "but how do I create a toggle switch that will change the values of the data island and then pass this to the variables"
What problems are you facing?
This is my workflow:
- create toggle in script (On that occasion i also added variable definition which reads from field - that would work for your example like plug&play as long as you remove from your app all variable input objects/buttons which can override that variable definition)
- Load data and set field properties to always one selected value
- Use any form of filter pane for selections to be applied (I am using filter pane and table chart to show how variable changes, so it could be used just like you are using it now)
Am I missing something here?
Obviously the object you will be using to toggle (filter pane, native buttons with actions select in field or other....) that is up to you.
Principle is the same: you have island table, you make it always one selected values and you use expression in variable to read that value.
cheers


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Is there a way to do this so that the field does not show up in the filters at the top?
I want to make the transition from the variable (which I use the variable input) to a field look the same for the users.
Thanks,
Michael

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @mstoler
I forgot to mention 2 important things:
- Always one selected value is not supported in NPrinting so for NPrinting I would have app which binary loads from the users app, but would have always one selected value removed from fields properties
- or if you dont want to manage 2 apps you need to think about workarounds. Example:
- Instead of using toggle - use buttons with actions
- variable uses expression which returns value if nothing is selected (aka default)
Obviously using second option requires a lot more work: creating button for each value, then if you want to make it looking nicer you would have to write expressions to capture what is current selection and based on that likely to apply colour on buttons which would indicate what is selected (or if nothing is selected then default state).
But all above is simple QlikView/Qlik Sense work we all were doing for years, so nothing new there.
cheers
Lech

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a follow up to your question about hiding selection - sure there is no issue with that, but there is a catch...
If you are going to use buttons like in my example with 2 blue buttons you have to configure them before you hide fields, because this object allows to configure only visible fields. To configure hidden fields you would have to edit object in Developer mode (aka with url suffix "/options/developer"
--> right click --> Developer and manually edit properties of such object) which may not be worth an effort.
So all what you do is configure objects while fields are still visible and when you are happy with results add that line to your script " TAG FIELDS UnitDollar WITH $hidden ;" and reload to hide field:
this is the result you would get - I dont know how to get rid of "hidden selection applied" message though, I reckon it needs to stay there:


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
And also I can use a default bookmark to assign an initial default value.
I assume the tag fields with $hidden is similar to the set HidePrefix='_' ;
Thanks again!
Michael

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would not use default bookmark-it may not be supported by nprinting. Similar to triggers in QlikView
I am not 100% sure about it, but i had issues with it in the past.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If I can't use default bookmarks then how can I set the default value of the field?
Michael

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you dont,
you can make variable to always set to one default value even if nothing is selected - just like i did. Using Max() or Min() returns only one value right?
I mentioned that in my previous comment already:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
regarding hiding fields - yes - there are multiple methods:
or
or mention earlier:

- « Previous Replies
-
- 1
- 2
- Next Replies »