5 Replies Latest reply: Jun 21, 2016 7:19 PM by Haikuo Yu RSS

    Return only one part of Getcurrentselections

    Friedrich Hofmann

      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

        • Re: Return only one part of Getcurrentselections
          Friedrich Hofmann

          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...

            • Re: Return only one part of Getcurrentselections
              Gysbert Wassenaar

              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)

                • Re: Return only one part of Getcurrentselections
                  Friedrich Hofmann

                  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

                    • Re: Return only one part of Getcurrentselections
                      Friedrich Hofmann

                      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

                    • Re: Return only one part of Getcurrentselections
                      Haikuo Yu

                      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!