Question

Read CSV multi-line header to define attribute value

  • 13 October 2021
  • 6 replies
  • 12 views

I am really, really new to FME and so trying to wrap my head around everything. Essentially I have a CSV that has multiple data sets one after another, split by a multi line section of header information that it not formatted the same way as the data. I'm trying to read each section of data and write it to a single database table. So for each section I need to read a specific line within the header area (Serial number and Counter Name) and then use that as one of the attributes in the writer.

 

Data should look like :

SerialNumber, CounterName, Date, Time, Value

 

When complete in order to write it to the table.

 

From the various posts I've found I think it might involve using a variable setter and variable retriever but I'm not sure how to make that work.

 

Any suggestions are appreciated.

 

 

FME Csv read


6 replies

Userlevel 4
Badge +30

Hi @nataliekovach​ 

 

Please, could you share us the sample of data?

 

Thanks in Advance,

Danilo

Here is a sample file.

Userlevel 4
Badge +30

Here is a sample file.

Thanks your data.

I created a Workspace to split and work with attributes.

Workspace_CSV 

Attached the Workspace template (.fmwt ).

 

Thanks in Advance,

Danilo

Thanks very much, that's definitely a start. Trouble is there are multiple sections of data within the file, each with a different serial number and counter name, so I need to be able to somehow recognize when a new section is encountered and then pull the serial number and name to apply the the following records.

 

The end data should look like this with each serial number and counter name for the applicable rows.

 

Sample End Data 

 

 

 

Badge +10

Adjacent Attribute handling is your friend here, you can set the value of Serial Number and Counter name each time a new one is encountered, otherwise each record takes the value from the record above

Capture

That is a thing of beauty, thank-you so much. This really helps, plus I'm learning all kinds of neat stuff.

Reply