PI消息映射中的函数介绍

PI消息映射中的函数主要分为多个类别,如算术、布尔、常量、转换等。函数操作值通常为字符串,但可能具有不同的语义数据类型。算术函数要求数值输入,如果无法解析,会引发Java异常。布尔函数返回'真'或'假',并能解释'1'和'true'为真。此外,还提供了日期格式设置和国家特定的日期计算规则。函数可以任意组合使用,以满足不同需求。
摘要由CSDN通过智能技术生成

转自:http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

General

Values of elements or attributes of the XML message (the payload ) are technically speaking a string. Therefore, all standard functions that operate on field values expect string arguments and return a string value. Nevertheless, the transferred value can of course have a different semantic data type, namely, the one that you specified when you defined the schema for the payload for the field. Standard functions exhibit the following standard behavior:

      Depending on the standard function, data type conversions are used to ensure that the values are transferred in a format suitable for the function (using a cast ). If the value cannot be interpreted, the mapping runtime triggers a Java exception.

      If-clauses evaluate conditions that return Boolean values. Standard functions that return Boolean values return the string true or false . Standard functions that expect Boolean values interpret the values “1” and “true” (not case-sensitive) as true and all other values as false .

Note

See also: Runtime Behavior

Overview of Functions

Data-flow objects for standard functions are structured as follows:

      Most data-flow objects have two or three inbound channels on the left-hand side, and one outbound channel on the right-hand side.

      If -functions are shaped as rhombuses or triangles.

      There are also conversion functions with one inbound and outbound channel and functions that return a value without any input.

      Standard functions that require additional specifications are indicated with a star (This graphic is explained in the accompanying text ). To call the dialog for Function Properties , double click the data-flow object.

The following figure provides an overview of all the different forms of data-flow objects:

This graphic is explained in the accompanying text

To illustrate how the individual functions are used, the input boxes in the figure above have the variables X , Y , Z or I , and the result variable is either R or O . All standard functions in the tables below are described using these input and output variables. In the data-flow editor, other data-flow objects that are connected to the functions using the connecting boxes either return the input values or receive the result of the operation. You can combine the functions in any way you require (provided that the values transferred to a function can be interpreted).

Function Category: Arithmetic

You can only enter numerical values for this category (this includes values with digits after the decimal point). If the value cannot be interpreted as a digit, then the system triggers a Java exception. In the default setting, all calculations are executed with the precision of the Java data type float . The format of the result value depends on the result:

      If the result is a value with digits after the decimal point, these remain unchanged.

      Exception: If a zero follows the decimal point, then this is cut off. This means that the result of the calculation 4.2 0.2 is 4 and not 4.0 .

Also note that Java values of type float are converted to the second system before the calculation. The result is calculated there and then this result is converted back to decimal format. The conversion may result in positions after the decimal point that are periodically repeated and then automatically cut off. In the decimal system, this can result in inaccurate results (example: 2.11 + 22.11 = 24.220001). If the number of positions after the decimal point is to be restricted to two, for example, in the case of values for a currency, you can format the values after the calculation by using the standard function FormatNum .

Note

If the particular usage case requires more detailed results, you can also select the decimal system as the basis for the calculations. The Java class BigDecimal is used for internal purposes. For more details see SAP Note 958486.

Function Name

Function

add

R = X + Y

subtract

R = X - Y

equalsA

R = true , if value X equals value Y , otherwise R = false . The values are interpreted numerically, therefore the value 1.5 is the same as 1.50 .

abs

O = Absolute value of I

sqrt

R is the square root of X

sqr

R is the square of X

sign

R =

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值