Skip to main content
Question

How to assign a value to a new field when if condition is met

  • September 10, 2021
  • 3 replies
  • 266 views

messagemauri
Contributor
Forum|alt.badge.img+6

Using FME Desktop 2021. I have an existing field LicenseNumber with null values and with numeric values. I want to create a new field called License_Values into a table if the following conditions are met:

 

Condition 1

If LicenseNumber is null

Then assign null values to License_Values

 

Condition 2

If LicenseNumber is not null (it has values)

Then assign 123 to License_Values

 

I tried AttributeCreator with a Condition value but it does not work at all. All

it does is assign 123 to every record in the new field called License_Value (Condition 2) and it does not write the null values to License_Value (Condition 1) . My final objective is to have the new field with null values and 123 as long as the conditions are met.

 

image1Condition 

Thank you, much appreciated.

3 replies

gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • September 10, 2021

I suspect that LicenseNumber is not NULL but one of the other states, Empty or Missing. Put everything through an AttributeFilter and see what ports they come out of.


messagemauri
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • September 10, 2021
gazza wrote:

I suspect that LicenseNumber is not NULL but one of the other states, Empty or Missing. Put everything through an AttributeFilter and see what ports they come out of.

@Gary Nicholson​ Thank you. Yes, I added the AttributeFilter and put everything through (Null, Empty, Missing), I then connected it to an Attribute Creator with all the conditions (Null, Empty, Missing) and it works.

 

Thanks Gazza


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • September 14, 2021

Alternatively you can use the Attribute Has a Value clause in the condition to bypass the NULL, EMPTY, MISSING state of the attribute.


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