Skip to main content
I have a scenario where I am using a tester on an attribute: for the values that do not pass, I want the value of the attribute to change to nothing (I want it be to a blank cell).

 

 

Is there a way to insert "nothing" with the ExpressionEvaluator by writing something? If I write nothing, the transformation works, but every time I get a warning since the gear symbol on expressionEvalutor remains red.

 

 

Alternatively, can I somehow mute this warning?
Hi,

 

 

I don't think the warning can be avoided as long as you are using the ExpressionEvaluator.

 

What about using the AttributeCreator?

 

 

Takashi
This was my initial thought, but I was unable to get the "if" syntax working in AttributeCreator.

 

 

Here is basically what I am after: Given that I have attributes A, B, and C:

 

 

if A minus B is less than 0, then the value is C, else it is blank. I tried something like this:

 

 

@if(@Evaluate(@Value(A)-@Value(B))<0,@Value(C),'')

 

 

and this fails. I didn't try too many iterations using this approach since I was unable to find any example of AttributeCreator using an if statement (wasn't certain it was supported).

 

 

Even if the above worked, I'm not sure if the last part before the bracket would produce a blank - likely it would produce a quote as the output rather than a blank. I assume FME would have issue with the end of the expression being:@Value(C),)?

 

 

 

 

 

 

 

 

 


Here's one way you can solve the problem.

 

 

1. Add an AttributeCreator 

 

 

 

 

2. In the 'Value' column, click "Conditonal Value"

 

 

3. In the Test Condion, select the dropdown arrow and Open Arithmetic Editor. Enter value A-B.

 

 

 

 

4. In the Operator, select the < sign.

 

5. In the Right Value, enter 0.

 

6. In the Output Value, Select the attribute "C"

 

7. When you hit Ok it brings you back to the If, ElseIf screen. In the Else, All Other Conditions - Output Value, Click the dropdown arrow and select Null. 

 

 

 

 

This will allow you to conditionally do your If A-B < 0 then C, Else Null statement.

 

 

 

-Matt
Agree with Matt. I believe the AttributeCreator with Conditional Value setting would be the best solution in this case.

 

The Conditional Value has been introduced in FME 2013 SP1. If your FME version doesn't support it, you can use a Tester to branch the data flow according to the condition, and use two AttributeCreators to set different value for each condition.

 

FME 2013-SP1: Conditional Processing in FME (http://blog.safe.com/2013/03/fmeevangelist113/)
Gio,

 

 

I agree about the if-construct, but try debugging a bunch of nested ifs when you re-open your workspace a year later.

 

 

Been there, done that, never want to do it again :-)

 

 

David

Reply