Skip to main content

I have multiple sensor output csv files that have the same field names that changes with every single file.  The locations of the fields stays the same which is good.  An example is ID, DATE, TEMP, COND_HIGH, COND_LOW.  If the reader field names are changing constantly what is a good way to strip those names and put the simple ones above in their place?  I have attempted or looked at the Schemamapper, but I’m not sure if that is the route to take.  The other way I messed with was Reader > UUID > AttributeExploder > AttributeCreator (Conditional Statements) > Aggregator?  Any help would be appreciated.  I think I am making this harder than it needs to be.

If the location of the field names stays the same in the CSV, you can change the reader to read from line 0 - this will cause the attributes to all be col0, col1, col2 etc, and you can proceed with a simple rename from there (after excluding the first two rows of “data”). Or even set up the schema yourself in the reader, set Attribute Definition to Manual.

Alternatively, you might be able to use some BulkAttributeRenamers with regular expressions, but looking at the data provided, reading from line 0 is easiest.

 


Thank you very much!  I knew I was working way too hard on this one.  


Reply