Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
datanibbler
Esteemed Contributor

Return only one part of Getcurrentselections

Hi,

in a document, I have a straight_table_object and in cell >A1< I want to have the current category (I have a drilldown group in my dimension).

I have already found out that I can get that info by using >Getcurrentselections<. The difficulty is only that this function gives me all the selections in the document - in a drilldown group, that translates into all the upper levels - if I have drilled down to the lowest level, the 2+ upper levels are all returned by the function. In that cell, however, I want only one.

I guess I can set a number in the last parameter for that function? Can anybody here tell me how do do that if I don't want to change any of the other standards? I cannot yet seem to get that right.

Thanks a lot!

Best regards,

DataNibbler

5 Replies
datanibbler
Esteemed Contributor

Re: Return only one part of Getcurrentselections

Hi,

I tried with the LEFT function (I tried to select only the first part of the returned string, up to the 2nd blank, but that doesn't work at all...)

As a workaround, I reduced the height of the textbox where that information is displayed so that only the first part fits in, but that is of course less than perfect...

MVP & Luminary
MVP & Luminary

Re: Return only one part of Getcurrentselections

You can use the separators to find the part you need.

getcurrentselections ([RecordSep [, TagSep [,ValueSep [, MaxValues]]]])

If you specify RecordSep and TagSep you can the use the characters in subfield to first find the last record and then the name of the field. Something like:

subfield(subfield(getcurrentselections('#','^'), '#' , -1),'^',1)


talk is cheap, supply exceeds demand
datanibbler
Esteemed Contributor

Re: Return only one part of Getcurrentselections

Hi Gysbert,

thanks a lot! So I need to specify the parameters of the function in a specific way and then I can use those to split out the part of the string that I want to display.

Great! I'll try that out as soon as my system has stopped loading and I can do any work on QlikView again 😉

Best regards,

DataNibbler

datanibbler
Esteemed Contributor

Re: Return only one part of Getcurrentselections

Hi Gysbert,

sorry for the delay. I don't quite understand the syntax you are using.

I can just copy-paste it and it does return something - but not quite the right thing.

It seems that QlikView is somehow sorting the selections alphabetically. So when I make one selection after another, every new one appears above the old one (in a textbox I have prepared to show this), only sometimes (depending on the letter a selection_field starts with) a new one appears below the old one and then the value returned by your formula changes.

Is there a way I can influence this?

Best regards,

DataNibbler

datalakeyu
Valued Contributor

Re: Return only one part of Getcurrentselections

Hi Gysbert ,

I use US state name as the map dimension. When I use

GetCurrentSelections (StateName, 1) & 'other information'

in the text expression, it still does not work. (text part will show all states that I have clicked on the map, I only need 1 state that I currently clicked on the map).

I also try to use pick function in Qlik, but it still does not work. (text part will show all states that I have clicked on the map, I only need 1 state that I currently clicked on the map).

Could you please give any suggestion?

Thanks!