Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Array position

Hello!

I have a problem and I don't know how to solve it with chart functions.

Suppose that I have a field with this possible values:

    John

    Michael

    Rose

    Danny

Then I could use concat( {<Name=>} distinct  [Name] ,',') to have the next value in a text field or function:

     John,Michael,Rose,Danny

Well, I'm looking for a way to show the order of selected item over field Name in that list.

Examples:

     If I select Jhon I want see 1

     If I select Rose I want see 3

Does anybody knows how can I solve this?

Thanks

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith
MVP
MVP

The match() function returns the number corresponding to a value in a list.  You would write the function something like this:

=match(Name, $(=concat({<Name=>} distinct  chr(39) & [Name]  & chr(39), ',')))

OR

=match('Danny', $(=concat({<Name=>} distinct  chr(39) & [Name]  & chr(39), ',')))

The dollar sign expansion is needed around the concat() so that it just returns the list of values to search over.

View solution in original post

3 Replies
Nicole-Smith
MVP
MVP

The match() function returns the number corresponding to a value in a list.  You would write the function something like this:

=match(Name, $(=concat({<Name=>} distinct  chr(39) & [Name]  & chr(39), ',')))

OR

=match('Danny', $(=concat({<Name=>} distinct  chr(39) & [Name]  & chr(39), ',')))

The dollar sign expansion is needed around the concat() so that it just returns the list of values to search over.

Anil_Babu_Samineni
MVP
MVP

I doubt, whether it will return correct number. I am assume, For Rose Match returns 4 not 3. I haven't check may be it will return 4 only.

Or May be Data island table will work for this case

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
Anonymous
Not applicable
Author

Thanks Nicole! It's fit for my solution