ExpressionEvaluator

Performs a mathematical calculation on an expression that consists of FME Feature Functions, String Functions, Math Functions, and Math Operators. The operands and function arguments consist of attributes on the input feature, constant literals, published and private parameters, as well as functions and operators.

You can use the GUI interface to set up an expression, but you can also edit an expression manually. The results of the expression are stored inside attributes specified by user.

There are two main uses for ExpressionEvaluator:

  1. Apply one expression to one attribute
  2. Apply one expression to multiple attributes
Note  If you want to apply different expressions to different attributes, you can either use multiple ExpressionEvaluators, or use a single AttributeCreator.

The supported operators are a subset of the operators permitted in C expressions. They have the same meaning and precedence as the corresponding C operators with one notable exception: they support numeric nulls.

Expressions are expected to yield numeric results. FME supports numeric nulls, which permit expressions to return null as result. For example, the expression 8.2 + 6 returns 14.2, whereas the expression @Value(nullAttr) * 1 returns null.

Note   It is easy to build an invalid expression, so you may want to double check your expression, especially if you are using an @Value(attr) within the expression, as some attributes may have unexpected values. If an expression is invalid, then the corresponding result attribute will be set to null. When the result is null, the following attributes will be set to indicate what went wrong, and where:

• fme_expression_warnings{}.attrName

• fme_expression_warnings{}.message

• fme_expression_warnings{}.transformerName

Inside the ExpressionEvaluator, null, missing, and empty string attributes are all considered to be null. Thus, @Value(attr) * 1 will result in null if attr is not present on the feature or is an empty string.

Configuration

Parameters

Example

FME Support Center has a good example of the ExpressionEvaluator.

Related Transformers

If you are setting more than one attribute, consider using the AttributeCreator, which contains the same functionality through the Arithmetic Editor.

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

Reference

Processing Behavior

Feature-Based

Feature Holding

No

Dependencies None
Aliases  
History  

FME Community

The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.

Search for all results about the ExpressionEvaluator on the FME Community.

 

Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.