Skip to main content
Question

FME CSV writer is removing leading zeros


geovision
Contributor
Forum|alt.badge.img+5

I'm trying to write data to a csv. I have a uniqe identifier that has two leading zeros. When writing to a csv file the zeros are removed. When viewing the feature information window the attribute has a string value. When doing the same in the written csv it says 64 unsigned integer even though I have set it to string in the writer parameters. What am I doing wrong? Making sure FME writes it as a string will keep the leading zeros right?

5 replies

geovision
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 2, 2023

Some clarification:

 

CSV reader feature attribute information (string)

imageCSV writer user attributes:

imageWritten CSV file (64 bit unsigned integer):

imageIt's like FME disregards the string type I chose in the writer settings, any idea how this is possible?


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • July 2, 2023

The writer setup seems fine, what does the string look like before it goes into the writer? Does it still have the leading zeros?


virtualcitymatt
Celebrity
Forum|alt.badge.img+35

Did you check the output CSV in just a text editor? It could be that the issue is happening when FME is reading back in the CSV file?

 


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • July 3, 2023

I get no problems when writing to CSV with the default settings. When opening the CSV with notepad, the leading zeroes are still there.

When importing this CSV file, FME does initially interpret the values as integers, but you can override this by manually changing the data type to string.


geovision
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 3, 2023

@virtualcitymatt​ I hadn't thought of that, csv file has the leading zeros. @geomancer​ checking the output on the writer removes the leading zero's but cheching the csv file in notepad++ shows that they are still there. ..

Weird! But anyway, problem is fixed now. Thanks for getting back to me.


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