Skip to main content
Question

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

  • May 21, 2021
  • 1 reply
  • 5 views

Forum|alt.badge.img

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

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • June 1, 2021

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.


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