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: 
Jsobrinho77
Creator
Creator

get distinct value

Hi guys,

I have a FieldD field into the script, that contains values like:

FiledA&,'',&FieldB&,'',&FieldC

sometimes its possible have the same values to all 'levels', so in the final result is:

A,A,A

I have tried concat (distinct total FieldD, ',') but the same result

The expected result is 

Distinct: A

How can do I do this?

tks

 

Labels (4)
1 Reply
Or
MVP
MVP

Ideally, I'd suggest you change this script-side by not concatenating FieldB and/or FieldC if they're the same value as FieldA (easily checked with an if() statement).

Assuming you only have these three values, you could probably write up something on the front end along the lines of:

Subfield(FieldD,',',1) &

if(Subfield(FieldD,',',1) <> Subfield(FieldD,',',2), ',' & SubField(FieldD,','2),'') &

if(Subfield(FieldD,',',2) <> Subfield(FieldD,',',3), ',' & SubField(FieldD,','3),'')

You could crosscheck the third subfield with both the first and the second if necessary. Note that if you "distinct" it, you would wind up with the same result for A,A,B and A,B,B and A,B,A (in all three cases, the "distinct" is A,B), so this can be fairly confusing...