Skip to main content

Hi all,

 

I'm wondering if it is possible to preserve the order of (unexposed) attributes when they come out of the Generic port of a FeatureReader. The attributes are coming out ordered alphabetically, I want them to remain in the order they appear in the schema.

 

My process involves a dynamic FeatureReader to grab data records, a SchemaMapper to map (some) attributes to new names, a SchemaScanner to determine the new schema and a dynamic writer to write features out in the new schema. The problem I have is that the new schema is coming out with attributes in alphabetical order, rather than in the original order (with the old attributes mapped to their new names).

 

imageIs it possible to preserve the attribute order from the Generic port of a FeatureReader?

 

Thanks!

Not sure is this will help but it may.

 

The FeatureReader can also produce a Schema Feature based on the initial dataset which will hold the correct order. You can manipulate this schema feature if you're able to. Or perhaps you are able to somehow use this SchemaFeature and compare it with the ScnemaScanner output to reorder it to what you want.

 

Unfortunately the SchemScanner can't detect the order unless the attributes are exposed in the workspace.


Thanks for the reply. I've managed to create a work around that is similar to what you describe. It takes the original schema output, explodes it and compares it against the document being used by the SchemaMapper to change the old attributes to their new new names and then reconstructs the schema. It's not particularly pretty but it works!


Thanks for the reply. I've managed to create a work around that is similar to what you describe. It takes the original schema output, explodes it and compares it against the document being used by the SchemaMapper to change the old attributes to their new new names and then reconstructs the schema. It's not particularly pretty but it works!

ahh nice to hear. If it's messy just hide it inside a bookmark or CustomTransformer haha 😃


Reply