Skip to main content

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.

Hi @lifalin2016

 

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

 


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


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?

 


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

 


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

[Addition] The Tester may not be essential.


Reply