Skip to main content

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

From:

IDColAColBColC1A1B1C12A2B2C23A3B3C34A4B4C45A5B5C5

 

To:

IDColumnNameValue1ColAA11ColBB11ColCC12ColAA22ColBB22ColCC23ColAA33ColBB33ColCC34ColAA44ColBB44ColCC45ColAA55ColBB55ColCC5

 

Can anyone help me out?

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

 


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:


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


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]