Skip to main content
Question

Copying attribute values - how to set a default value in the output if blanks/nulls in the source?

  • November 7, 2016
  • 7 replies
  • 229 views

fmelizard
Safer
Forum|alt.badge.img+22

I need something like this: if the value is NULL or non-existent, then name field as "UNKNOW", else where bring the values assigned to it.

How can I tell FME to separate the NULL and empty cells from the numbered ones?

For example:

feature 1 has attribute ‘someattr’ == blank, then attribute ‘someoutput’ = UNKNOW

feature 2 has attribute ‘someattr’ with a value, then attribute ‘someoutput’ = the value from ‘someattr’ attribute

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.

7 replies

fmelizard
Safer
Forum|alt.badge.img+22
  • Author
  • Safer
  • November 7, 2016

See this workspace for an example:

attributevaluemapper.fmw

Screenshot:


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • November 7, 2016

Have a look at the NullAttributeMapper. That transformer seems to fit the description.

NullAttributeMapper


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • November 7, 2016

The AttributeManager can also be used for this if else kind of statements and the attribute mapping.


fmelizard
Safer
Forum|alt.badge.img+22
  • Author
  • Safer
  • November 8, 2016

See this workspace for an example:

attributevaluemapper.fmw

Screenshot:

Here is a screenshot showing settings to update a TYPE attribute. In this case the source TYPE attribute has some single space values ' ', which need to be replaced with text 'UNKNOW'.

 

 

https://www.dropbox.com/s/izo4hin9o1c0hz2/Screenshot%202016-11-08%2000.15.30.png?dl=0

 


mark2atsafe
Safer
Forum|alt.badge.img+59
  • Safer
  • November 8, 2016

The AttributeManager can also be used for this if else kind of statements and the attribute mapping.

That's what I was thinking. Set it up to create 'someoutput' using the conditional option, with the condition being the value of 'someattr'

 

 


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • November 8, 2016

Have a look at the NullAttributeMapper. That transformer seems to fit the description.

NullAttributeMapper

Reading the question again: First copy 'someattr' in 'someoutput' and then use the NullAttributeMapper on 'someoutput'.

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • November 8, 2016

if the attribute exists u can also simply use a creator for this.

@SomeAttr == ""?"Empty":@SomeAttr

if misses or Null it results in a missing operand error.