Tutorial corner

Informatica,ETL,oracle,sql/plsql

Fibonacci series in Informatica : Informatica Scenario question

Spread the love

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 .

Fibonacci series in Informatica

Fibonacci series in Informatica

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.

SRC

1
2
3
4
5
6
7
8
….
100

We need to create one informatica mapping to load Fibonacci number in our target table i.e TRG. It should contains like mentioned below.

TAR

1
2
3
5
8
13
…..

Must Check here for convert column into row in informatica

Steps to Create Informatica Mapping to Load Fibonacci

STEP 1:

  • 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:

PORT PORT_TYPE PORT EXPRESSION
COL  I/O
 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 3: Now connect the Expression Transformation to the Filter Transformation and specify the Filter Condition as o_flag=1

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.

The Author

Alisha Lamba

Hello Friends , I am Alisha Lamba .I love to write article on latest technologies like Informatica , ETL , data warehouse , SQL-PL SQL
Copyright 2015 - Tutorial Corner Frontier Theme