Fibonacci series in Informatica : Continuing with our series of informatica scenario based interview question , in this article we will see how to implement Fibonacci series in informatica . I believe you must have already designed this program in native language like C++ or Java .
What is Fibonacci Series ?
The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number(called a Fibonacci number) is equal to the sum of the preceding two numbers.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
Fibonacci series in Informatica
Let suppose there is one input table SRC which contains in only one column COL having data as counting from 1 to 100 like shown below.
We need to create one informatica mapping to load Fibonacci number in our target table i.e TRG. It should contains like mentioned below.
Must Check here for convert column into row in informatica
Steps to Create Informatica Mapping to Load Fibonacci
- Drag the source to the mapping designer
- In Source Qualifier Transformation properties, set the number of sorted ports to one. This will sort the source data in ascending order So that we will get the numbers in sequence as 1, 2, 3, ….100
- You can also use sorter transformation to sort input data
STEP 2 :
- Connect the Source Qualifier Transformation to the Expression Transformation.
- In the Expression Transformation, create three variable ports and one output port. Assign the expressions to the ports as shown below.
Ports in Expression Transformation:
|v_sum||V||v_prev_val1 + v_prev_val2|
|v_prev_val1||V||IIF(COL=1 or COL=2,1, IIF(v_sum = COL, v_prev_val2, v_prev_val1) )|
|v_prev_val2||V||IIF(COL=1 or COL =2, 2, IIF(v_sum=COL, v_sum, v_prev_val2) )|
|o_flag||O||IIF(COL=1 or COL=2,1, IIF( v_sum=COL,1,0) )|
STEP 4: Connect the Filter Transformation to the Target Table TRG.
So overall Fibonacci informatica mapping will look like
SRC -> SQ –> EXP –> FILTER –> TAR
So in this informatica tutorial , we saw how to implement Fibonacci series in informatica mapping.