你在这里: Calculators 的ExpressionEvaluator

的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.

其他e are two main uses for ExpressionEvaluator:

  1. Apply one expression to one attribute
    • Evaluation Modeto eitherCreate New AttributeorOverwrite Existing Attributes,but only overwrite one attribute.
    • expression might use@值()功能,但不使用@CurrentAttribute()功能。
    • For example, if you want to add 1 to the values in a single attribute, use the expression@Value(attr) + 1,组Evaluation ModetoOverwrite Existing Attributes,and setAttributes to Overwritetoattr
  2. Apply one expression to multiple attributes
    • Evaluation ModetoOverwrite Existing Attributes只有选择将用新值覆盖的属性。未选定的属性将保留其原始值。
    • expression might use@CurrentAttribute()功能,但通常不会使用@值()功能。
    • 例如,如果你想在几个属性加1的值,使用表达式@CurrentAttribute() + 1,组Evaluation ModetoOverwrite Existing Attributes,and select the attributes to apply this to.

Note:如果你想不同的表情适用于不同的属性,您可以使用多个ExpressionEvaluators,或使用一个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.

表达式预期收益率的数值结果。FME支持数字空值,这允许表达式返回null作为结果。例如,表达8.2 + 6回报14。2,而表达@Value(nullAttr) * 1返回null。

Note:这是很容易建立一个无效的表达,所以你可能要仔细检查你的表达,特别是如果你使用的是@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)* 1will result in null ifattr上不存在的特征或者是一个空字符串。

参数

算术编辑器

欲了解更多信息,请参阅算术编辑器。

表达式编辑器

An expression consists of a combination of operators and operands, functions and arguments, and parentheses. White spaces may be used between the operands, operators, and parentheses, and are ignored by the expression processor.

Where possible, operands are interpreted as integer values. Integer values may be specified in decimal, such as123,in octal if the first two characters of the operand are0o(zero followed by the letter o), or in hexadecimal if the first two characters of the operand are0x

如果操作数不具有以上给出的整数格式之一,那么它将被视为一个浮点数,在可能的情况。浮点数可以以任何的由一个符合ANSI-C编译器接受的方式被指定,所不同的是“F”,“F”,“L”和“L”后缀不会在大多数安装允许的。例如,以下所有的都是有效的浮点数:2。13。6e47.91e+16。If no numeric interpretation is possible, then an operand is left as a string and should cause the expression to evaluate to null.

Operands and arguments may be specified in the following ways:

  • As a constant numeric value, either integer or floating point.
  • 作为一个特征FME属性的值,使用该@值()or@CurrentAttribute()notation. The attribute's value is used as the operand or argument.
  • As an FME feature function, such as@区域()。该函数被评估并用作操作数或参数的结果。
  • As a mathematical function, such as@sin(1)

FME Feature Functions

For more information, seeFME Feature Functions

String Functions

For more information, seeString Functions

Math Functions

For more information, seeMath Functions

Math Operators

For more information, seeMath Operators

FME知识中心拥有的ExpressionEvaluator的一个很好的例子。

Related Transformers

If you are setting more than one attribute, consider using theAttributeCreator,其中包含通过相同的功能算术编辑器

Editing Transformer Parameters

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, clickbeside the applicable parameter. For more information, seeTransformer Parameter Menu Options

Transformer Categories

Calculators

Technical History

在的ExpressionEvaluator数学运算是基于工具命令语言(TCL)EXPR命令。1Tcl及其文档版权归再保险gents of the University of California, Sun Microsystems, Inc. and other parties. However, the authors have granted permission to any party to reuse and modify the code and documentation, provided the original copyright holders are acknowledged.

标签算术

Search FME Knowledge Center

Search for samples and information about this transformer on theFME知识中心