Solved

Any ideas how to parse csv data in single attribute?

  • 25 September 2018
  • 6 replies
  • 40 views

Badge

I have csv data in a single attribute like this (field names are first line).

Grower,Date,SampleNum,P,K,C

1000,05/01/2018,350,275,1500

how can I parse this into feature(s) with the correct collums using fme?

icon

Best answer by david_r 26 September 2018, 21:32

View original

6 replies

Userlevel 2
Badge +12

In the CSV reader you can:

- Check the box to have field names in the first row

- Determine the , to be the separator

FME will then read all rows and use the first row for attribute naming.

Badge

In the CSV reader you can:

- Check the box to have field names in the first row

- Determine the , to be the separator

FME will then read all rows and use the first row for attribute naming.

Sorry, I wasn't very clear, my data originates in an attribute downloaded from a webservice, not an actual csv file.

 

 

Userlevel 2
Badge +12
Sorry, I wasn't very clear, my data originates in an attribute downloaded from a webservice, not an actual csv file.

 

 

You can still do the same.

 

But use the AttributeFileWriter to write to a CSV file, followed by a FeatureReader to read as CSV.

 

 

Userlevel 2
Badge +17
Sorry, I wasn't very clear, my data originates in an attribute downloaded from a webservice, not an actual csv file.

 

 

Alternatively, you can use the HTTPCaller to download and save the CSV data into a file. You can then re-read the file with the FeatureReader (Format: CSV).

 

 

Badge

In the CSV reader you can:

- Check the box to have field names in the first row

- Determine the , to be the separator

FME will then read all rows and use the first row for attribute naming.

I wasn't able to get the feature writer to feature reader flow working, messed around with it for a bit but it still just returns my csv data under one attribute. Seems like I'm missing something simple. The data I'm working with is embedded in an xml response from a SOAP api. I've attached the entire xml response so you can see what I'm referring to. download-resuts.xml. I'm using the xml fragmenter to extract the data from get_sampleresultsResults attribute.

 

 

Userlevel 4

I believe this answer should cover your case:

https://knowledge.safe.com/questions/78520/parse-csv-data-stored-in-database-table.html

The first feature will contain the attribute names, the following features will contain the values. If necessary you can use the Sampler to get rid of the first feature.

Reply