Question

CSV Reader - Option: "File Has Field Names: yes"

  • 17 March 2014
  • 7 replies
  • 6 views

Hello,

 

 

my problem is to read a CSV file without field names. You can find the images mentioned in the error description in the folder "Screenshots" .

 

 

It read and process the file " Importbeispiel_100_Adressen.csv " successfully. I use the parameters as shown in the screenshots "csv_parameter_1.jpg" and  "promt_and_run_1.jpg". The expected result ("_target_url") is correct:

 

 

"http://fvs72.lgb.local/gdigeokoder/RestService/GeokodiereAdresse?key=zgnsjf&str=Milmersdorfer%20Chaussee&hn=25&hne=&plz=17268&ort=Ahrensdorf&ot=&srs=EPSG:25833"

 

 

If I want to read the file "Importbeispiel_100_Adressen_oue.csv" (see "promt_and_run_2.jpg") it does not work. The "_target_url" can not be properly generated:

 

 

"http://fvs72.lgb.local/gdigeokoder/RestService/GeokodiereAdresse?key=zgnsjf&str=&hn=&hne=&plz=&ort=&ot=&srs=EPSG:25833"

 

 

I suspect the problem lies here (see log): "CSV Reader : File Has Field Names : yes". As can be seen in the file "csv_parameter_1.jpg", I have the option disabled. Nevertheless, they will call for both activated. Furthermore, thereby also skipped the first line.

 

 

Here is the workbench and screenshots:

 

https://www.dropbox.com/s/qg2vr92v03vdod1/Massengeokodierung_REST_FME.zip

 

 

Version:

 

Edition: FME Desktop ESRI Edition (floating)

 

Version: FME(R) 2013 SP3 (20130729 - Build 13528 - WIN32)

 

 

Thank you for your efforts!

7 replies

Userlevel 4
Hi,

 

 

you might have better luck using the Python CSV module if your CSV data is a bit complex or contains special characters. I have posted a working example of how to do this here (http://fmepedia.safe.com/CommunityAnswers?id=906a0000000ckLRAAY).

 

 

David
Badge +3
hi,

 

 

It skips the firstline because u have lines to skip 1 Header set to to yes.

 

One input file has a header the other not, so it seems logical not to use same settings on both.

 

 

When u make a custom transformer, the settings prompted override the ones in the navigator i think.

 

So even if you have "number of lines to skip" 0 (linked to skip-lines_csv) in the navigator, the screenshot in your csv_parameter_1.jpg shows its goin to skip a header (prompted).

 

 

Look at a part of a workbench i made. Look at the "promptscreen" and the settings in the Navigator. The ones in the prompt Override.

 

 

 

Gio

 

 

HI,

 

 

@Gio:

 

I thing the problem is in the option "File Has Field Names". This is always set to "yes". No matter what I have previously defined. This will also set "Number of Lines to Skip = 1", although I have said in the query at the start, "Number of Lines to Skip = 0".

 

You can see it in the logs:

 

 

a) "Number of Lines to Skip = 0", CSV without header

 

CSV Reader: Separator Character: ';'

 

CSV Reader: Skip Duplicate Delimiters: no

 

CSV Reader: Strip Quotes From Fields: yes

 

CSV Reader: File Has Field Names: yes

 

CSV Reader: Field Names Follow Header: no

 

CSV Reader: Number of Lines to Skip: 1

 

CSV Reader: Number of Footer Lines to Skip: 0

 

CSV Reader: Allowing Spaces in Column Names: yes

 

CSV Reader: Max features to scan for schema: 10000

 

CSV Reader: A column name of 'col2' was used to replace a blank column name

 

CSV Reader: Opening dataset 'C:\\Users\\ulbrichg\\Desktop\\Massengeokodierung_REST_FME\\Input\\Importbeispiel_100_Adressen_oue.csv'

 

 

b) "Number of Lines to Skip = 1", CSV with Header

 

CSV Reader: Separator Character: ';'

 

CSV Reader: Skip Duplicate Delimiters: no

 

CSV Reader: Strip Quotes From Fields: yes

 

CSV Reader: File Has Field Names: yes

 

CSV Reader: Field Names Follow Header: no

 

CSV Reader: Number of Lines to Skip: 1

 

CSV Reader: Number of Footer Lines to Skip: 0

 

CSV Reader: Allowing Spaces in Column Names: yes

 

CSV Reader: Max features to scan for schema: 10000

 

CSV Reader: Opening dataset 'C:\\Users\\ulbrichg\\Desktop\\Massengeokodierung_REST_FME\\Input\\Importbeispiel_100_Adressen.csv'

 

 

Please give can you give me the link to your Workbench?

 

Thanks!

 

 

@David:

 

That will probably be the solution for my problem. With your pattern it will work.

 

 

I'll let you know if it worked. Thanks!

 

Georg
Userlevel 4
Hi,

 

 

you might also want to try and upgrade to FME 2013 SP4 to see if this issue has been resolved there.

 

 

David
Hi David,

 

 

i have tested it already with:

 

Edition: FME Desktop ESRI Edition (floating)

 

Version: FME(R) 2014 (20140120 - Build 14235 - WIN32)

 

 

The problem is the same. But in 2014 i can't find this menu

 

https://www.dropbox.com/s/flu080r4kw41ov1/csv_parameter_1.jpg

 

 

Georg
David, can you please show me as a template a workbench in which you use your own CSV reader with the Python Creator?
I could solve my problem. I'm not sure what it was. However, I re-added to the CSV reader and set the option "Merge Feature Type".

 

 

Thanks for the replys!

Reply