Question

Reading files, renaming their attributes together, but writing the files back with the original attribute structure

  • 21 May 2021
  • 1 reply
  • 2 views

Badge

I'm reading a couple of files, and they have some matching attributes. I want to rename those attributes in one go, but write the files with their original attribute structure only. However when I write the files, they all end up with the combined attributes. Filtering empty attributes is not possible because some files have attributes with no values. Copying the reader settings on the writer(s) also doesn't work out because the names would be wrong. Is there a way to keep the original structure, with the new names?

 

Basically this:

 

attr


1 reply

Userlevel 2
Badge +17

Hi @clickingbuttons​,

If you read the source files using a FeatureReader transformer, it will output schema features as well as the data features. These schema feature can be used to set the output schema of a writer using Dynamic schemas.

The schema features will contain a list of the feature's attribute names in a list named 'attributes{}'. You can edit the values of this list to rename the output fields to match the updated data features.

The FeatureReader will output the schema feature before any of the data features, and the writer needs to get the schema feature first as well. Please do not place any blocking transformers in the path of the schema features.

Reply