Skip to main content
Solved

Keep only unique value on a concatenate attribute

  • September 6, 2017
  • 8 replies
  • 235 views

Forum|alt.badge.img

Hi everybody,

I've a new question, I'm creating a "concatenate attribut" with an aggragator, and I would like to only keep unique values on that concatenate attribut.

At the moment, I've this kind of results "0.1,0.1,0.1,0.2", and I would like to just keep "0.1, 0.2".

I've tried a lot of things, with lists etc... but I failed, to find a way to do that.

Do you have any advice to do that ?

Kind regards,

Nicolas

Best answer by david_r

Weird, works for me:

0684Q00000ArKIKQA3.png

Before:

`_list{0}' has value `0.1'
`_list{1}' has value `0.1'
`_list{2}' has value `0.1'
`_list{3}' has value `0.2'

After:

`_concatenated' has value `0.1,0.2'
`_list{0}' has value `0.1'
`_list{1}' has value `0.2'

Since you're having floating point numbers, are you sure they're 100% identical? Remember that e.g. 0.1 and 0.099999 won't be treated as a duplicate by the ListDuplicateRemover.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

8 replies

david_r
Celebrity
  • 8394 replies
  • September 6, 2017

If it's a list, have you tried the ListDuplicateRemover before concatenating?


Forum|alt.badge.img
  • Author
  • 12 replies
  • September 6, 2017

Thanks @david_r, no it's not a list.

But I tried to generate a list with the aggregator and then, use a ListDuplicateRemover, but it didn't work


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3434 replies
  • September 6, 2017

If it's a list, have you tried the ListDuplicateRemover before concatenating?

 

If it's not a list already then an AttributeSplitter, followed by a ListDuplicateRemover then a ListConcatenator is probably the way to go

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • September 6, 2017

Weird, works for me:

0684Q00000ArKIKQA3.png

Before:

`_list{0}' has value `0.1'
`_list{1}' has value `0.1'
`_list{2}' has value `0.1'
`_list{3}' has value `0.2'

After:

`_concatenated' has value `0.1,0.2'
`_list{0}' has value `0.1'
`_list{1}' has value `0.2'

Since you're having floating point numbers, are you sure they're 100% identical? Remember that e.g. 0.1 and 0.099999 won't be treated as a duplicate by the ListDuplicateRemover.


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • September 6, 2017

I tried the same approach and it works for me too:

Just to be sure: your decimal delimiter is not a comma (same as the values delimiter)?


takashi
Celebrity
  • 7843 replies
  • September 6, 2017

Hi @nmeriotdev, to clarify what happened when you tried the ListDuplicateRemover, can you post the list contents logged by Loggers?

Insert two Loggers before and after the ListDuplicateRemover like this, and run.

0684Q00000ArKhIQAV.png

Then, post the result shown on the Translation Log window, like this.Before
Logger: Feature is:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `Logger_LOGGED'
Attribute(encoded: utf-8): `_list{0}.attr' has value `0.1'
Attribute(encoded: utf-8): `_list{1}.attr' has value `0.1'
Attribute(encoded: utf-8): `_list{2}.attr' has value `0.1'
Attribute(encoded: utf-8): `_list{3}.attr' has value `0.2'
After
Logger_2: Feature is:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `Logger_2_LOGGED'
Attribute(encoded: utf-8): `_list{0}.attr' has value `0.1'
Attribute(encoded: utf-8): `_list{1}.attr' has value `0.2'


Forum|alt.badge.img
  • Author
  • 12 replies
  • September 7, 2017

Hi,

Sorry I wasn't at the office. So with your answers I've deleted/create again everything and now it work. I think I was just missing the list concatenator after the duplicateRemover.

Thanks a lot guys.

Nicolas


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • September 7, 2017

@nmeriotdev

Regexp Replace

([^-]*)(-\\1)+($|-)', '\\1\\3')

Change the delimiter to your needs. Objects must be sorted.