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
  • 150 views

fmelizard
Safer
Forum|alt.badge.img+18

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

7 replies

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

See this workspace for an example:

attributevaluemapper.fmw

Screenshot:


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

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

NullAttributeMapper


itay
Supporter
Forum|alt.badge.img+17
  • 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+18
  • Author
  • Safer
  • November 8, 2016
fmelizard wrote:

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+44
  • Safer
  • November 8, 2016
itay wrote:

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+17
  • Contributor
  • November 8, 2016
erik_jan wrote:

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.


Reply


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