Transformation language 方法 IN, MAX

来源:互联网 发布:乐山seo外包公司 编辑:程序博客网 时间:2024/06/03 19:02

IN()

Matches input data to a list of values. 默认情况下,匹配时大小写敏感。

语法
IN( valueToSearch, value1, [ value2, ..., valueN, ] CaseFlag )
查找的值valueToSearch可以是String, date或者numeric value。CaseFlag必须是整数,当为0或者空时,大小写不敏感,为其他整数时,大小写敏感。

返回值
TRUE(1),查找值存在于值列表中
FALSE(0),查找值不在值列表中
NULL,输入值为空时

例子
IN( ITEM_NAME, ‘Chisel Point Knife’, ‘Medium Titanium Knife’, ‘Safety Knife’, 0 )
ITEM_NAME
返回值
Stabilizing Vest
0 (FALSE)
Safety knife
1 (TRUE)
Medium Titanium knife
1 (TRUE)
 
NULL

MAX()

Returns the latest date,  the largest numeric value or the highest string value within a port or group. You can apply a filter to limit the rows in the search. You can nest only one other aggregate function within MAX. 

Note: The MAX function uses the same sort order that the Sorter transformation uses. However, the MAX function is case sensitive, and the Sorter transformation may not be case sensitive. 

语法

MAX(date/numeric_value/string [ , filter_condition])

过滤条件是可选的,过滤条件必须是数字值或者等于TRUE,FALSE,NULL。

当通过的所有值为空,或者是过滤条件为假或者空时,返回值是NULL。


Group By:

Max函数基于在transformation中定义的group by port分组,一组一个返回值,如果没有定义group by port,则将所有值看成一组,返回一个值。


例子:

返回 flashlights的最高价格:

MAX( PRICE, ITEM_NAME='Flashlight' )
ITEM_NAME
PRICE
Flashlight
10.00
Regulator System
360.00
Flashlight
55.00
Diving Hood
79.00
Halogen Flashlight
162.00
Flashlight
85.00
Flashlight
NULL
返回值: 85.00


原创粉丝点击