Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Displaying single result for one to many field

I am trying to use the following expression to display the Primary Contact as a column so that each individual only has one line of data in a straight table.

=If ([Contact Type]='Primary', [Contact], '-')

But since an individual can have more than one contact type, this only works when the client has ONLY a primary contact or no contact. In this example, only Client "2" would return a Contact name, all others would return "-" because the Contact Type is not "equal" to "Primary".

load * inline

[Client Code, Contact Type, Contact

1, Primary, Susan

1, Secondary, Martha

2, Primary, Alex

3, Primary, David

3, Secondary, James

3, Emergency, Mary];

Is there another way to write this?

Alternatively, I have had success in similar cases with the following expression:

count({<AGE={'18','19'},GENDER={'M'}>} NAME)

but in this case I don't want to calculate anything, I just want the data in the field to display.

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Tania,

                    This table's expression will show all the Primary contacts for the clients.

Client Code =Concat({$<[Contact Type] = {'Primary'}>}Contact,',')
Alex,David,Susan
1Susan
2Alex
3David

Regards

Andrew

View solution in original post

2 Replies
effinty2112
Master
Master

Hi Tania,

                    This table's expression will show all the Primary contacts for the clients.

Client Code =Concat({$<[Contact Type] = {'Primary'}>}Contact,',')
Alex,David,Susan
1Susan
2Alex
3David

Regards

Andrew

Not applicable
Author

Perfect! Thank you!