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: 
gileswalker
Creator
Creator

getfieldselections() function used with Master Dimensions which are controlled by variable input

Hello All,

Hoping someone with a lot of experience can assist please, re getfieldselections() function.

My project is to use the getfieldselections() function to display user data filter choices in a text object, so it’s easy for users to quickly see how they have filtered data in their chart, because when they share the chart, they can also share the choices made to create it.  It makes for clarity in data sharing, reducing unnecessary communications.  I have had this working successfully before when using normal filters in Qlik.  The below is an example of a simple output, where the yellow shaded values have come from this function.

gileswalker_0-1709844551575.png

Today I am trying to get the getfieldselections() function to work with master dimensions and I am hitting a roadblock.

Back story:  The new app I am working on uses the variable input custom object to provide flexibility in creating dynamic charts:

gileswalker_1-1709844551577.png

Basically, users can choose from a drop down list of dimensions, and the chosen field becomes the X axis of my chart.  Here is what that looks like in the app:

gileswalker_2-1709844551578.png

That drop down list is linked to master dimension called [🛠️ DIY Dimension], and that master dimension is coded as:

=pick($(vDimension), $(MD_Grp_Dimension_Field_Value))

Anyway, functionally this all works great. 

The issue I have is how I hook this master dimension to the getfieldselections() function.  The reason I am interested in this is because if a user selects a value IN the chart object (ie NOT using the standard filter pane), the chart renders to that choice and in the selections bar at the top of the screen we see this:

gileswalker_3-1709844551579.png

So Qlik displays the name of the master dimension, NOT the dimension that has been selected in the chart object.

Now, when trying to use the getfieldselections() function with master dimension [🛠️ DIY Dimension] creates an expression error that I don’t fully understand eg:

gileswalker_4-1709844551580.png

 

I have tried all the possible ways I can to get this to work, some of which is quite silly, like using $() and ‘’ and “”, and even using the underlying pick() function from the master dimension itself.

But nothing works.  Either the Edit Expression is an error, or the code is accepted but generates a null outcome when viewed in a table object 

I would like this to work, because then my users can select from the chart object and the normal filter pane, and all their choices will get displayed.  If it doesn’t work, any choices inside the object will not get noted in the text object output.

Is this something that can work, or is what I am attempting not supported?

I really appreciate anyone's thoughts/advice on this.

Thanks and regards

Giles

Labels (4)
6 Replies
Anil_Babu_Samineni

@gileswalker I am worried on this statement.

"So Qlik displays the name of the master dimension, NOT the dimension that has been selected in the chart object."

Can you show the Video why Qlik is showing Master dimension and not actual dimension? Where did you used the master dimension and how you selected that which actually showing the master dimension title in toolbar? 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
gileswalker
Creator
Creator
Author

@Anil_Babu_Samineni thanks for asking.  Hopefully the below explains a bit more detail for you to see what is going on.

The master dimension is added to the bar chart like this:

gileswalker_0-1709858859595.png

 

The master dimension uses that pick function, and we have the variable input object linked, so user gets to choose their dimension (and measure) and change their mind whenever they want.

Now, in my example below, we have this linked up to a bar chart - you can see the dimension and measure values are chosen in the variable input objects, and the chart renders.  This chart has values in 2021, 2022, 2023, and 2024, but I just clicked on the actual blue bars 2022 and 2023 to filter the data, to leave what you see below. That then puts the master dimension up in the toolbar.

 
 
 

gileswalker_4-1709859197122.png

 

If you click on the master dimension in the tool bar you can see the 2 values selected:

gileswalker_5-1709859406106.png

 

If I leave those values selected, and then simply change the variable dimension to this:

gileswalker_6-1709859469153.png

 

....the chart will change dimension accordingly, still with the master dimension filter active.....

gileswalker_7-1709859542013.png

 

.....and if I select some origin country values, again by clicking in the chart's blue bars, that filters the data accordingly, and another master dimension goes up to the tool bar:

 

gileswalker_8-1709859602503.png

 

If I click on the 2nd master measure in the tool bar, you can see the 3 selected values I chose in the bar chart:

 

gileswalker_9-1709859663618.png

 

Now, I am not sure if this is how Qlik 'should' behave.   I figured it was how Qlik is set up to react to what I have set up.....would be better if the name of the dimension was seen, not the master dimension name of [🛠️ DIY Dimension].

 

Using Qlik On Premise:

gileswalker_10-1709860011430.png

 

 

 

 

gileswalker
Creator
Creator
Author

Thanks for the suggestion @marcus_sommer .  In testing that out, there is now a visible result that I wasn't getting with the original getfieldselections function.  When displayed in a text object, it does retrieve the name, see below in green:

 

gileswalker_1-1710095462494.png

This is great, thank you.

In the above screen shot, the first 2 lines (Parent Client, and Agent) were chosen from the filter pane, and the last 2 were selections of bars from the bar chart, which reference the master dimension.

So now I can see the selection. 

However, this is presenting the next challenge, which is that the master measure name [🛠️ DIY Dimension] is being displayed, rather than the underlying dimension that the master dimension is referencing.

Is there a way to actually show the actual dimension name, not the master dimension name?  For interest the configuration of the master measure is this:

 

gileswalker_2-1710095774630.png

 

It's like Qlik is "partially" ignoring the MD_Grp_Dimension_Label_Value part of the label expression .  I say "partially" because it is displaying the dimension label in charts ok, but in terms of it displaying in the selections tool bar, and with getcurrentselections function, it's not.

For clarity, there is a SET expression in the load statement which holds the label values for MD_Grp_Dimension_Label_Value:

 

gileswalker_3-1710098665831.png

These correspond to the 'pick' value landing in vDimension, from the variable input object

I really appreciate your help and any ideas you may have with this small problem I have.

Thanks

gileswalker
Creator
Creator
Author

Additional update: Seems there is further issues - despite getcurrentselections() revealing the dimension name, there is an inconsistency in the name of the dimension it is displaying. I have 9 x  'DIY Dimension' master dimensions, and sometimes filtering data by clicking in the object to select dim values, returns the wrong master dimension name, ie returns 'DIY Dimension 8' when the choice was made on 'DIY Dimension 1', see below:

 

gileswalker_0-1710101505779.png

 

marcus_sommer

In regard to show the selections within a text-box you may consider to replace there the master-dimensions with the underlying field-names, like:

replace(replace(getcurrentselections(), ..., ...), ..., ...)

In regard to the native selection-pane it wouldn't change anything.

Beside this I wouldn't tend to use the pick() approach and applying with an expression a synthetic dimension else applying a real field-reference with the help of a $-sign expansion. This means the dimension-selections contained already the real field-names or they are directly associated to them - and then you could fetch it with something like:

[$(=minstring([MyDimensionsField]))]

I'm not sure if this really solved your task to show the selections but it will simplify the matter and avoiding further challenges in regard to synthetic dimensions. By using something like the above suggested method you may also use the approach to fetch these selections like:

'$(=minstring([MyDimensionsField]))' & ': ' &
getfieldselections([$(=minstring([MyDimensionsField]))])