问题描述
源表中的数据如下:-
Empno Ename sal
101 Allen 1000
102 Alex 2000
103 Tom 1500
104 Cb 2100
我希望输出如下:-
Empno Ename sal
101 Allen 0
102 Alex 1000
103 tom 2000
104 Cb 1500
请问我可以使用哪种转换来达到结果.另外请让我知道逻辑.
Can you please tell me by using which transformation i can acheive the result. Also plz let me know the logic.
推荐答案
添加具有两个变量端口的表达式转换:
Add an expression transformation with two variable ports:
PORT EXPRESSION
in_sal N/A
v_previous_sal v_current_sal
v_current_sal in_sal
out_sal v_previous_sal
阅读文档摘录以了解端口顺序:
Read this excerpt from the documentation to understand the port order:
-
输入端口.集成服务首先评估所有输入端口,因为它们不依赖于任何其他端口.因此,您可以按任何顺序创建输入端口.由于它们不引用其他端口,因此Integration Service不会订购输入端口.
Input ports. The Integration Service evaluates all input ports first since they do not depend on any other ports. Therefore, you can create input ports in any order. Since they do not reference other ports, the Integration Service does not order input ports.
可变端口.可变端口可以引用输入端口和可变端口,但不能引用输出端口.因为可变端口可以引用输入端口,所以Integration Service会在输入端口之后评估可变端口.同样,由于变量可以引用其他变量,因此变量端口的显示顺序与Integration Service评估每个变量的顺序相同.
Variable ports. Variable ports can reference input ports and variable ports, but not output ports. Because variable ports can reference input ports, the Integration Service evaluates variable ports after input ports. Likewise, since variables can reference other variables, the display order for variable ports is the same as the order in which the Integration Service evaluates each variable.
例如,如果您计算建筑物的原始值,然后调整折旧,则可以将原始值计算创建为可变端口.该可变端口需要出现在根据折旧进行调整的端口之前.
For example, if you calculate the original value of a building and then adjust for depreciation, you might create the original value calculation as a variable port. This variable port needs to appear before the port that adjusts for depreciation.
输出端口.因为输出端口可以引用输入端口和可变端口,所以Integration Service会最后评估输出端口.输出端口的显示顺序无关紧要,因为输出端口无法引用其他输出端口.确保输出端口显示在端口列表的底部.
Output ports. Because output ports can reference input ports and variable ports, the Integration Service evaluates output ports last. The display order for output ports does not matter since output ports cannot reference other output ports. Be sure output ports display at the bottom of the list of ports.
这篇关于Informatica:上一列值显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!