- Router和Filter很相似,Router可以用一或多个Filter来取代,不同的是用Router来生成多个组时输入数据只需处理一次,所以效率更高;
- Router 由一个输入组,一到多个用户定义的输出组和一个默认组组成,每一个用户定义的输出组含一个测试条件,满足条件的输入数据会进入相应的用户定义组,不满足所有用户定义条件的数据会进入默认组;
- 输入组和输出组的端口类型和名称相同;
- Powercenter根椐连接的用户定义输出组的顺序来进行评估,如果默认组没有连接,则不评估那些没有连接的用户定义输出组;
- 如果某一行符合多个输出组的评估条件,则出现在多个组的输出数据流中;
- 可以将一个输出组的端口连到多个Transformation或者Target上,但不能将多个输出组的端口连到一个Transformation或者Target上;
Sorter
- Sorter用来排序数据,可以指定多个排序端口,每个端口可以指定升降序,字符串比较时可以忽略大小写,还可以用Distinct选项来消除重复(所有端口,包括没有指定排序的端口);
- 排序时会用到输入数据两倍大小或者更大的空间,默认的排序Cache是8M,可选的排序Cache范围是1M到4G,排序Cache不够时,服务器会将数据临时存储在排序目录,如果指定的排序Cache无法满足,会话会失败,可以用文档中提到公式计算Cache;
- 当配置使用 Distinct属性时,所有的端口都会用于排序;
- 默认情况下,NULL大于任何值,可以配置NULL值小于任何值;
Union
- Union可以将多个数据流合并成一个数据流,功能类似于SQL中的UNION ALL;
- Union可以有多个输入组,只有一个输出组,输入组和输出组有一一对应的端口;
- Ports 页不可编辑,只能编辑Groups 和 Group Tabs页;
Rank
- Rank可以用来返回根椐某个端口排序的最大或者最小的N条记录,并且可以指定分组;可以用于得到去除的重复资料(比如5条相同数据,只取了一条,那么另外四条可以由这个加上Sqerence组合得到其它四条.).
- Rank中可以使用分组,但并不能使用分组函数,可以指定多个分组端口,但用于排序的Rank端口不可用于分组;
- Rank端口有五种属性:I(输入),O(输出),V(变量),R(排序),G(分组),至少需要有一个输入端口和一个输出端口,排序端口有且只有一个,而且必须输出,排序端口和变量端口不能用于分组;
- 输入端口的数据只能来自一个Transformation;
- 有一个默认的Rankindex端口,表示输出行在排序中的位置;
- 如果是字符排序,可以选择大小敏感或者大小写不敏感;
- Top X 中的X数量表示前几条数据(Rankindex的值就是顺序),当Rankindex一样时,取其中部分,比如Top1,有两条记录的Rankindex为1,则取其中一条.其受cache限制,可按需调整cache.
Procedure
- 存取过程一般用于处理较为复杂的数据,分为连接型与非连接型,连接型一般用于取得返回值,非连接型一般用于在session执行前后执行一些动作,比如检查数据库空间之类的,但是可以完成所有连接型的功能,可用于Output Port作为expression.
- 如果是只有单个返回参数(out parameter)则使用方法类似:sp.sp_xxx(inID,proc_result),proc_result为PM保留变量.如果有多个返回参数则需要定义本地变量来接收,比如sp.sp_xxx(inID,$$var1,proc_result),参数位置与类型必须与sp里面定义的一致.
- 同个Procedure不得同时作为连接型与非连接型.
- 可以使用多层嵌套存取过程.
Transaction Control
1.功能:用于控制事务的Commit, Rollback, Continues.,比如一年的销售情况,可以按照月份分类,每个月作为一个Transaction来控制,这样就可以对单个月进行排序或者提交什么的.
2.简介:
在Properties Tab页,主要属性为Transacion Control Condition, 在里面写控制事务的表达式,表达式的返回的值只能是以下值.
TC_CONTINUE_TRANSACTION |
No transaction changes will be performed for this row. This is the default TC expression. |
TC_COMMIT_BEFORE |
Commit and Begin a new transaction before this row written to the target. |
TC_COMMIT_AFTER |
Write this row to the target and COMMIT the transaction and begin a new transaction. |
TC_ROLLBACK_BEFORE |
Rollback the current transaction. Begin a new transaction and write row to target. |
TC_ROLLBACK_AFTER |
write the row to the target and rollback the transaction. Begin a new transaction |
注意:当表达式的返回的值为TC_ROLLBACK_BEFORE或 TC_ROLLBACK_AFTER时需要设置session的Treat source rows as Data driven,要不WorkFlow会为failed.
Transaction Control transformations are transaction generators.
They define and redefine transaction boundaries in a mapping. They drop any incoming transaction boundary from an upstream active source or transaction generator, and they generate new transaction boundaries downstream.
Transaction Control transformations can be effective or ineffective for the downstream transformations and targets in the mapping.
The Transaction Control transformation becomes ineffective for downstream transformations or targets if you put a transformation that drops incoming transaction boundaries after it. This includes any of the following active sources
or transformations:
¨ Aggregator transformation with the
All Input level transformation scope
¨ Joiner transformation with the All Input level transformation scope
¨ Rank transformation with the All Input level transformation scope
¨ Sorter transformation with the All Input level transformation scope
¨ Custom transformation with the All Input level transformation scope
¨ Custom transformation configured to generate transactions
¨ Transaction Control transformation
¨ A multiple input group transformation, such as a Custom transformation,
connected to multiple upstream transaction control points
Although a Transaction Control transformation may be ineffective for a target, it can be effective for downstream transformations
Transaction Control Mappings with Multiple Targets
If each target is connected to an effective Transaction Control transformation, the mapping is valid.
If one target in the mapping is not connected to an effective Transaction Control transformation, the mapping is invalid.