Skip to main content
Solved

Any ideas how to parse csv data in single attribute?

  • September 25, 2018
  • 6 replies
  • 136 views

johnglick
Contributor
Forum|alt.badge.img+1

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?

Best answer by david_r

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.

View original
Did this help you find an answer to your question?

6 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • September 25, 2018

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.


johnglick
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 25, 2018
erik_jan wrote:

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.

 

 


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • September 25, 2018
johnglick wrote:
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.

 

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • September 26, 2018
johnglick wrote:
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).

 

 


johnglick
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 26, 2018
erik_jan wrote:

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.

 

 


david_r
Evangelist
  • Best Answer
  • September 26, 2018

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.


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