Skip to main content
Hi there,

 

I have a REALLY badly formatted CSV file which is generated automatically by the software - the output can't be altered.

 

 

The data shows calls to a service centre. Unfortunately, instead of adding the call handlers name to a column for their calls, its added as a row before. There's then an emoty row before the details for  the next handler.

 

 

I need to take this call handler name and add it to a column for their data only (ie before the next empty row). Any ideas on how to do this? This is my first step into the world of FME so I'm have in a baptism of fire...

 

 

Kind Regards,

 

Ned
Hi

 

 

You could configure the CSV reader to skip the first two lines:

 

 

 

 

You could the add a Text file reader with the Maximum number of features to read set to 1. This should take care of your call handler name. Then use a FeatureMerger to join the call handler name onto the CSV lines.

 

 

David
Hi David,

 

 

Thanks for your reply. I've tried that but it doesn't appear to work. I think my data is even more badly formatted than I think! I've attached a screen grab to show how awful it is...

 

 

 

 

 
Hi

 

 

My suggestion is to try and read the CSV file normally. Then use a TestFilter with the following conditions:
  • If: the DATE attribute = "Cisco", then you know that the TIME attribute will contain the call handler name. Use a VariableSetter to store the value of TIME as the call handler name, then do nothing.
  • Else if: the DATE and TIME attributes are both empty, you know that it is either the summary or the separator row. Use the VariableSetter and set the call handler name to blank, then do nothing.
  • Else: then you know it's a data row. Use the Variable Retriever to get the call handler name and then send the feature to the writer.
It could look something like this:

 

 

 

 

David
Brilliant! Thanks for your help David. Much appreciated.

 

 

Neil

Reply