Skip to main content
Solved

FeatureWriter Exports to Excel are adding 0's into NULL fields

  • November 17, 2020
  • 20 replies
  • 52 views

oliver.morris
Contributor
Forum|alt.badge.img+14

Hi, really odd one, I had to update an existing workbench that has been in place for at least 6 months. When it exports data from a sql server table to excel the featurewriter puts in 0's where there should be nulls. Another featurewriter using the same source but writing to csv behaves itself. Any ideas what could be going on? Some screenshots of the data going in and the design are below.

 

I have not upgraded the writer. This is the same if run from desktop or cloud.

 

21 

Best answer by andreaatsafe

Update on this issue:

This issue was resolved in FME 2021.1 and newer.

Null values will now be written as a blank value when writing to Excel.

 

You can get the latest version of FME here: https://www.safe.com/support/downloads/

 

-Andrea

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

20 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • November 17, 2020

Do you use an Excel template?

What is the FME version?


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 17, 2020

@nielsgerrits​ thanks for the quick reply. I am using 2020.1.3 I am not using an Excel template but rather setting the attributibutes from an empty sql server table3


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 17, 2020

@nielsgerrits​ thanks for the quick reply. I am using 2020.1.3 I am not using an Excel template but rather setting the attributibutes from an empty sql server table3

How do the zeros in the excel spreadsheet screenshot relate to the nulls in the inspector screenshot, they appear to show different attributes?


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 17, 2020

How do the zeros in the excel spreadsheet screenshot relate to the nulls in the inspector screenshot, they appear to show different attributes?

Sorry for the confusion, basically anything that is marked as null in the inspector is being populated with 0 when it goes into excel format. If you change to csv it remains as a null field.


davtorgh
Contributor
Forum|alt.badge.img+11
  • Contributor
  • 105 replies
  • November 17, 2020

Hi @oliver.morris​ ,

 

I noticed that in your workspace the attributes coming from the FeatureReader (generic port) are not exposed. Maybe this could affect the Excel Writer, so you could try to insert an AttributeExposer before the FeatureWriter, expose some of the attributes (maybe one or two, just for test) with null values and see how the Excel Writer writes the data.

 

Hope that helps!


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 17, 2020

Hi @oliver.morris​ ,

 

I noticed that in your workspace the attributes coming from the FeatureReader (generic port) are not exposed. Maybe this could affect the Excel Writer, so you could try to insert an AttributeExposer before the FeatureWriter, expose some of the attributes (maybe one or two, just for test) with null values and see how the Excel Writer writes the data.

 

Hope that helps!

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • November 17, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

Just to be sure, you are writing a new file each time? Not adding to existing?

And are you sure it is not a FeatureCaching issue?


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 17, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

yes, a new file each time. The bug was found when I tested the output from a workbench I had published to fme cloud so I dont think it is FeatureCaching. I just dont get why the csv works and excel doesnt.


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 17, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

A bit of a longshot, but could it be bulk mode related, can you put in a pythoncaller doing nothing beforehand to break the bulk mode?


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 17, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

thanks for the suggestion, it didnt work unfortunately, I will raise as a bug.


davtorgh
Contributor
Forum|alt.badge.img+11
  • Contributor
  • 105 replies
  • November 19, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

I discovered myself that if you read from a database (in my case it's a sqlite database) null-value data in a field defined to be of type number, for some reason the excel writer writes out 0 and not null values.

 

I agree with you @oliver.morris​ , this should be a bug.


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 19, 2020

@davtorgh​ thank you for the suggestion, unfortunately no joy:

11

thanks @davtorgh​ I did report it as a bug, no response yet though


jkr_wrk
Influencer
Forum|alt.badge.img+35
  • 424 replies
  • November 20, 2020

Maybe you can trick FME by using the NullAttributeMapper, set all attributes to the value 'Jibberish' and then set all the values that are 'Jibberish' to NULL?

 

 


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • November 20, 2020

Maybe you can trick FME by using the NullAttributeMapper, set all attributes to the value 'Jibberish' and then set all the values that are 'Jibberish' to NULL?

 

 

Thanks for the suggestion but the tables here can be huge so I would really like to avoid this option if possible. The bug is with @daraghatsafe​ to review at the moment, will update this tread on the findings. thank you


davtorgh
Contributor
Forum|alt.badge.img+11
  • Contributor
  • 105 replies
  • May 7, 2021

Hi @oliver.morris​ ,

 

this issue seems related to numeric type fields in the source database tables and I think I've found a workaround. You can use a NullAttributeMapper to map null values to empty string before the Excel Writer.

 

Bye!


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • July 7, 2021

Hi @oliver.morris​ ,

 

this issue seems related to numeric type fields in the source database tables and I think I've found a workaround. You can use a NullAttributeMapper to map null values to empty string before the Excel Writer.

 

Bye!

apologies for the delay but this seems to have done the trick, thank you


andreaatsafe
Safer
Forum|alt.badge.img+14
  • Safer
  • 450 replies
  • Best Answer
  • September 3, 2021

Update on this issue:

This issue was resolved in FME 2021.1 and newer.

Null values will now be written as a blank value when writing to Excel.

 

You can get the latest version of FME here: https://www.safe.com/support/downloads/

 

-Andrea


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • September 7, 2021

Update on this issue:

This issue was resolved in FME 2021.1 and newer.

Null values will now be written as a blank value when writing to Excel.

 

You can get the latest version of FME here: https://www.safe.com/support/downloads/

 

-Andrea

Hi Andrea thanks for letting me know, I dont see the featurewriter as upgradable in 2021.1 it it just a general fix rather than transformer related? thanks


andreaatsafe
Safer
Forum|alt.badge.img+14
  • Safer
  • 450 replies
  • September 7, 2021

Hi Andrea thanks for letting me know, I dont see the featurewriter as upgradable in 2021.1 it it just a general fix rather than transformer related? thanks

The fix was with the Excel library so it wasn't specific to the FeatureWriter.

The update should happen automatically for the FeatureWriter when you upgrade to FME 2021.1 or newer.

-Andrea


oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 176 replies
  • September 15, 2021

Update on this issue:

This issue was resolved in FME 2021.1 and newer.

Null values will now be written as a blank value when writing to Excel.

 

You can get the latest version of FME here: https://www.safe.com/support/downloads/

 

-Andrea

Hi @andreaatsafe​ tested and now deployed to production, working as expected, nulls not 0's, thank you very much