Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chrweber
Creator
Creator

Pick ith element from concat or similar

Hi, I wish to pick the i'th element of a concatenated selection

=pick(1, concat( [Field], ', ' ))

I would have thought that I should be possible however, currently the second argument is interpreted as a single argument and not as many.

Is my approach possible and am I just missing something?

22 Replies
tamilarasu
Champion
Champion

I think the issue with the space after comma in the Getfieldselections delimiter parameter. To understand this better, please see below screenshot. Have a look at the attached file. You can check easily spot the issue by adding the expression straight table like below .

Capture.PNG

chrweber
Creator
Creator
Author

Well Spotted! Thank you

tamilarasu
Champion
Champion

Christoph Weber wrote:

Thank you, the placement of char(39) is still a mystery to me.

Chr(39) is nothing but a single quote. We have to add single quotes around the selected values so I just used chr(39) here. You may ask why not use single quotes directly. If we use single quotes around the filed name then QlikView will consider that as a Text instead of field name.

Capture.PNG

Below link may help you to understand about Ascii table.

https://www.asciitable.com/

Hope this is clear now.

tamilarasu
Champion
Champion

No Problem. Have a fantastic day!

chrweber
Creator
Creator
Author

Thank you for that explanation.

I know about the effects and ' as well as the use of chr(39).

It is just its application together with the $-expansion that has me at a loss, sometimes.

tamilarasu
Champion
Champion

Agree with you. Sometimes it will confuse us.

chrweber
Creator
Creator
Author

I appreciate the momentum of this discussion and would like to go a little beyond the scope of the question:

And want to relate to your answers here:

How to get rank positions

I have a small selection and a number field.

Now i want to show the rank of one specific field by somehow extending the following: =aggr(Rank( sum( {1} [Numbers]) ) , [Field])

This is my failing solution, so far.

=aggr(Rank( sum( {1<[Field]={'$(=SubField(GetFieldSelections( [Field],',',3),',',1))'}>} [Numbers]) ) , [Field])

What am I doing wrong?

tamilarasu
Champion
Champion

I'm sorry. Could you please explain with sample data and expected output. It will be really easy for me to provide you some idea. Hope this is fine with you.

chrweber
Creator
Creator
Author

Load *

inline [

Field, Numbers

A , 1

B, 2

C, 3

D, 4

]

Assuming any selection,

I want to show the Rank of Element 'C' in a Textbox (or some other object with similar proeprties)

Basically:

=aggr(Rank( sum( {1<[Field]={'C'}>} [Numbers]) ) , [Field])

This should be 2 (As it has the second highest Number - I hope I apply Rank correctly)

tamilarasu
Champion
Champion

You can simply try below expression in textbox,

=Aggr(Rank( sum( {1} [Numbers]) ),Field)