Skip to main content
Solved

Each column value in separate row


I am new to FME and I wish to make the following transformation.

From:

IDColAColBColC1A1B1C12A2B2C23A3B3C34A4B4C45A5B5C5

 

To:

IDColumnNameValue1ColAA11ColBB11ColCC12ColAA22ColBB22ColCC23ColAA33ColBB33ColCC34ColAA44ColBB44ColCC45ColAA55ColBB55ColCC5

 

Can anyone help me out?

Best answer by ebygomm

AttributeExploder, keep Attributes set to Yes, followed by a tester to get rid of the format attributes and an attribute keeper to keep only the ID, attribute name and attribute value

 

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

4 replies

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • March 24, 2020

AttributeExploder, keep Attributes set to Yes, followed by a tester to get rid of the format attributes and an attribute keeper to keep only the ID, attribute name and attribute value

 


  • Author
  • March 25, 2020
ebygomm wrote:

AttributeExploder, keep Attributes set to Yes, followed by a tester to get rid of the format attributes and an attribute keeper to keep only the ID, attribute name and attribute value

 

Thanks a lot!

For a more generic approach for handling different CSV files, I've altered the Tester to:


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • March 25, 2020
fentanyl wrote:

Thanks a lot!

For a more generic approach for handling different CSV files, I've altered the Tester to:

Yes, it's a pity that you cannot choose to ignore unexposed/format attributes when exploding

You can vote for it here

https://knowledge.safe.com/idea/19187/option-to-select-attributes-that-should-not-be-exp.html


drandall
Participant
Forum|alt.badge.img
  • Participant
  • April 10, 2025

Add a PythonCaller with the following def input() section:

def input(self, feature: fmeobjects.FMEFeature):
        attrs = feature.getAllAttributeNames()
        for i, attr in enumerate(attrs):
            attribute_feature = fmeobjects.FMEFeature()
            attribute_feature.setAttribute('field_order',i)
            attribute_feature.setAttribute('field_name',attr)
            attribute_feature.setAttribute('example_data',feature.getAttribute(attr))
            self.pyoutput(attribute_feature)
        pass

 

Attributes to expose: field_order field_name example_data

Attributes to hide: [SELECT ALL]


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