Skip to main content
Solved

Duplicate elements according the multiple attribute values ?

  • February 14, 2017
  • 5 replies
  • 43 views

lifalin2016
Contributor
Forum|alt.badge.img+29

Hi,

I'm faced with a task, where I need to duplicate some elements with regard to several attribute values (if they have one). It's not a filter since any of the attributes may or may not have a value, so each oruginal element may yields between 0 and N copies of itself.

I can't seem to find a suitable transformer for such a task. Can anyone point me towards one.

I would prefer not to have to hard code this with multiple transformer paths with several transformers.

Cheers.

Best answer by takashi

If I understand the requirement correctly, this workflow does the trick.

[Addition] The Tester may not be essential.

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

5 replies

Forum|alt.badge.img+7
Hi @lifalin2016

 

I find it hard to get your question. Might it be possible to provide us with an example?

 


Forum|alt.badge.img+1
  • February 14, 2017

If I understand your question correctly, the AttributeExploder might be of use. https://www.safe.com/transformers/attribute-exploder/


takashi
Evangelist
  • February 14, 2017
Hi @lifalin2016, I'm unclear your requirement.

 

Assuming each feature could have three attributes called A, B, and C. Do you mean that two copies of the feature should be created when it has A = 2, B = <null>, C = <null>.

 

If so, how many copies should be created when A = 2, B = 3, C = 1?

 


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • February 14, 2017
Hi jeroenstiers.

 

 

If each element/feature has say 50 attributes, but I only want to test 3 of them (let's say attributes "Ph1", "Ph2", "Ph3"), I want one copy feature if attribute "Ph1" has a value, another copy feature if "Ph2" has a value, and another copy feature if "Ph3" has a value.

 

 

I.e. the original feature yielding 0, 1, 2, or 3 new features depending on whether the attributes each have a value.

 

 

AttributeExploder explodes all 50 attributes, and forces me to hard code which values to test for. Cumbersome and expensive. I am looking for a more generic approach.

 

 

Cheers

 


takashi
Evangelist
  • Best Answer
  • February 14, 2017

If I understand the requirement correctly, this workflow does the trick.

[Addition] The Tester may not be essential.


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