Solved

Change order of attributes (outside the writer)

  • 14 July 2015
  • 2 replies
  • 19 views

I'm working on distributing data from a public administration. The data are documented in reports which describe the signification of each attribute. It's important to us that the attributes in the data appear in the same order as described in the document.

 

 

To do that attributes ordering, I used to move each user attribute up or down in the writer's "Feature Type Properties" window. This works very well... until I change the output :-(

 

 

So my question is : is it possible to change the order of attributes with a transformer (outside the writer) ? An 'AttributeSorter' or 'AttributeOrganizer' transformer would be perfect for this.

 

 

Thank you for your help !

 

 

Best regards,

 

Samuel
icon

Best answer by david_r 14 July 2015, 15:45

View original

2 replies

Userlevel 5
Hi

 

 

The short answer is no, it's not possible, you have to define the attribute order on the output feature type.

 

 

The long answer is that it might be possible using the following advanced technique: Use the SchemaSetter (https://store.safe.com/transformers/schemasetter) to extract the schema definition from each passing feature. Sort the resulting attributes{}-list according to your needs, then send the features to a dynamic writer set to use the schema defined in the list attributes{}. Use this article as a starting point: https://knowledge.safe.com/articles/Samples_and_Demos/Dynamic-Workflow-Tutorial-Destination-Schema-is-Derived-from-List-Attributes

 

 

David
Thank you. I will try the "long answer", and I hope the short one will be available for FME 2016 ;-)

Reply