Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Make the Getcurrentselections function sort its return value

Hi,

in a textbox in my current document, I want to show the last selection (actually, I have a drilldown group as dimension and I want to display the level_I_just_came_down_from). The function works fine. It does not, however, display the selections in the order I make them - since the selections actually represent the process of drilling down into the data and I actually want to display only the next_level_up, not all the prior selections, the sorting order is very crucial.

Can anybody lend me a hand here? What is the default sorting order of that function and how can I influence it?

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

I'm not sure if I understood what you need, but try this:

=GetFieldSelections($(=pick(match(GetCurrentField([New Group]), 'Dim1', 'Dim2', 'Dim3'), '', 'Dim1', 'Dim2')))

In the Match() content, replace the Dim1, Dim2, Dim3 with your Dimensions in the correct order.

In the Pick() content, do the same, but consider that it must pair the Upper Dimension so the Lower dimension will not appear here.

Attached a sample.

Hope this helps you

Fernando

View solution in original post

4 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

I'm not sure if I understood what you need, but try this:

=GetFieldSelections($(=pick(match(GetCurrentField([New Group]), 'Dim1', 'Dim2', 'Dim3'), '', 'Dim1', 'Dim2')))

In the Match() content, replace the Dim1, Dim2, Dim3 with your Dimensions in the correct order.

In the Pick() content, do the same, but consider that it must pair the Upper Dimension so the Lower dimension will not appear here.

Attached a sample.

Hope this helps you

Fernando

datanibbler
Champion
Champion
Author

Hi Fernando,

yes, that example looks exactly like what I want. The textbox only displays the next-upper value from out of the drilldown group. I don't quite understand the syntax of your expression yet, but I'll try to redo it that way in my document.

Thanks a lot!

Best regards,

DataNibbler

P.S.: One more question rgd. this and a problem:

- Problems first: I get an error in the expression when I enter the name of my group: The name is >Packbereich< - in the label_field in the >edit group< dialog, there is exactly that name, too.

- A question: Once I have this working so far, can I expand it - and how - to encompass more levels (I will have five or six in the end, the very first (actually not part of the drilldown group) will be a date selection and then there will be four or five drilldown levels.

Thanks a lot!

P.P.S.: Ok, the problem is solved - don't ask me how, I changed it and changed it back and now it's seemingly the very same as before, but it works 😉

So only the question of expanding that syntax remains.

fosuzuki
Partner - Specialist III
Partner - Specialist III

To encompass more levels and consider the Date selection as the first, you just have to add them as following:

=GetFieldSelections($(=pick(match(GetCurrentField([New Group]), 'Dim1', 'Dim2', 'Dim3', 'Dim4', 'Dim5', 'Dim6'), 'DateField', 'Dim1', 'Dim2', 'Dim3', 'Dim4', 'Dim5')))

Hope this works.

Fernando

datanibbler
Champion
Champion
Author

Thanks!

I'll try this. I'm pretty sure this will work, it looks very good.

Best regards,

DataNibbler