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: 
Sebastian_Dec
Creator III
Creator III

Removing duplicates from a variable in expression

Hi,

How can I remove duplicates from a variable in the expression?
I have variable from the user, a list od EAN separated by space.

I have two diffrent variable (I only need to remove duplicates from one)

iCodes -> a variable that takes on values ​​entered by the user, e.g.: 5907595424530 5907595425643 5907595425643 5907595424554

iCodesFormatted -> iCode variable which is formatted, with commas and quotation marks added, takes the value: "5907595424530","5907595425643","5907595425643","5907595424554"

=chr(34) & replace(iCodes, ' ', chr(34) & ',' & chr(34)) & chr(34)



I try use Aggr and concat but code in expression dont work:

=Concat(DISTINCT Aggr(Only(SubField(iCodesFormated, ' ')), SubField(iCodesFormated, ' ')), ' ')

 

=Concat(DISTINCT SubField(iCodes, ' '), ' ')

 

Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.
Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@Sebastian_Dec  try below

=concat(distinct SubField('$(iCodes)',' ',ValueLoop(1,$(=SubStringCount(iCodes,' '))+1)),' ')

 

View solution in original post

2 Replies
Kushal_Chawda
MVP
MVP

@Sebastian_Dec  try below

=concat(distinct SubField('$(iCodes)',' ',ValueLoop(1,$(=SubStringCount(iCodes,' '))+1)),' ')

 

Sebastian_Dec
Creator III
Creator III
Author

@Kushal_Chawda thank you, it works 🙂

5907595424530 5907595425643 5907595425643 5907595425643 5907595424554 5907595424530

converts to:

Sebastian_Dec_0-1723549181418.png

 

Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.