Skip to main content
Question

Read CSV multi-line header to define attribute value


nataliekovach
Contributor
Forum|alt.badge.img

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

danilo_fme
Evangelist
Forum|alt.badge.img+42
  • Evangelist
  • October 13, 2021

Hi @nataliekovach​ 

 

Please, could you share us the sample of data?

 

Thanks in Advance,

Danilo


nataliekovach
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • October 13, 2021

Here is a sample file.


danilo_fme
Evangelist
Forum|alt.badge.img+42
  • Evangelist
  • October 13, 2021
nataliekovach wrote:

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


nataliekovach
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • October 14, 2021

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 

 

 

 


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • October 14, 2021

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


nataliekovach
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • October 15, 2021

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


Reply


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