Skip to main content
Solved

Keep only unique value on a concatenate attribute

  • September 6, 2017
  • 8 replies
  • 172 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.

View original
Did this help you find an answer to your question?

8 replies

david_r
Celebrity
  • September 6, 2017

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


Forum|alt.badge.img
  • Author
  • 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+38
  • Influencer
  • September 6, 2017
david_r wrote:

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
  • 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+18
  • Contributor
  • 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
Influencer
  • 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
  • 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
  • September 7, 2017

@nmeriotdev

Regexp Replace

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

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings