Sei sulla pagina 1di 58

ADVANCED CONCEPTS IN INFORMATICA

MAPPING PARAMETERS & VARIABLES


Mapping parameters and variables represent values in mappings and mapplets.

When we use a mapping parameter or variable in a mapping, first we declare the


mapping parameter or variable for use in each mapplet or mapping. Then, we
define a value for the mapping parameter or variable before we run the session.

MAPPING PARAMETERS

 A mapping parameter represents a constant value that we can define before


running a session.
 A mapping parameter retains the same value throughout the entire session.

Example: When we want to extract records of a particular month during ETL


process, we will create a Mapping Parameter of data type and use it in query to
compare it with the timestamp field in SQL override.

 After we create a parameter, it appears in the Expression Editor.


 We can then use the parameter in any expression in the mapplet or mapping.
 We can also use parameters in a source qualifier filter, user-defined join, or
extract override, and in the Expression Editor of reusable transformations.

MAPPING VARIABLES

 Unlike mapping parameters, mapping variables are values that can change
between sessions.
 The Integration Service saves the latest value of a mapping variable to the
repository at the end of each successful session.
 We can override a saved value with the parameter file.
 We can also clear all saved values for the session in the Workflow Manager.

We might use a mapping variable to perform an incremental read of the source. For
example, we have a source table containing time stamped transactions and we want
to evaluate the transactions on a daily basis. Instead of manually entering a session
override to filter source data each time we run the session, we can create a
mapping variable, $$IncludeDateTime. In the source qualifier, create a filter to
read only rows whose transaction date equals $$IncludeDateTime, such as:
TIMESTAMP = $$IncludeDateTime

In the mapping, use a variable function to set the variable value to increment one
day each time the session runs. If we set the initial value of $$IncludeDateTime to
8/1/2004, the first time the Integration Service runs the session, it reads only rows
dated 8/1/2004. During the session, the Integration Service sets $
$IncludeDateTime to 8/2/2004. It saves 8/2/2004 to the repository at the end of the
session. The next time it runs the session, it reads only rows from August 2, 2004.

Used in following transformations:

 Expression
 Filter
 Router
 Update Strategy

Initial and Default Value:

When we declare a mapping parameter or variable in a mapping or a mapplet, we


can enter an initial value. When the Integration Service needs an initial value, and
we did not declare an initial value for the parameter or variable, the Integration
Service uses a default value based on the data type of the parameter or variable.

Data ->Default Value

Numeric ->0

String ->Empty String

Date time ->1/1/1

Variable Values: Start value and current value of a mapping variable

Start Value:

The start value is the value of the variable at the start of the session. The
Integration Service looks for the start value in the following order:

1. Value in parameter file


2. Value saved in the repository
3. Initial value
4. Default value

Current Value:

The current value is the value of the variable as the session progresses. When a
session starts, the current value of a variable is the same as the start value. The
final current value for a variable is saved to the repository at the end of a
successful session. When a session fails to complete, the Integration Service does
not update the value of the variable in the repository.

Note: If a variable function is not used to calculate the current value of a mapping
variable, the start value of the variable is saved to the repository.

Variable Data type and Aggregation Type When we declare a mapping variable in a
mapping, we need to configure the Data type and aggregation type for the variable.
The IS uses the aggregate type of a Mapping variable to determine the final current
value of the mapping variable.

Aggregation types are:

 Count: Integer and small integer data types are valid only.
 Max: All transformation data types except binary data type are valid.
 Min: All transformation data types except binary data type are valid.

Variable Functions

Variable functions determine how the Integration Service calculates the current
value of a mapping variable in a pipeline.

SetMaxVariable: Sets the variable to the maximum value of a group of values. It


ignores rows marked for update, delete, or reject. Aggregation type set to Max.

SetMinVariable: Sets the variable to the minimum value of a group of values. It


ignores rows marked for update, delete, or reject. Aggregation type set to Min.

SetCountVariable: Increments the variable value by one. It adds one to the


variable value when a row is marked for insertion, and subtracts one when the row
is Marked for deletion. It ignores rows marked for update or reject. Aggregation
type set to Count.
SetVariable: Sets the variable to the configured value. At the end of a session, it
compares the final current value of the variable to the start value of the variable.
Based on the aggregate type of the variable, it saves a final value to the repository.

Creating Mapping Parameters and Variables

1. Open the folder where we want to create parameter or variable.


2. In the Mapping Designer, click Mappings > Parameters and Variables. -or-
In the Mapplet Designer, click Mapplet > Parameters and Variables.
3. Click the add button.
4. Enter name. Do not remove $$ from name.
5. Select Type and Data type. Select Aggregation type for mapping variables.
6. Give Initial Value. Click ok.

Example: Use of Mapping of Mapping Parameters and Variables

 EMP will be source table.


 Create a target table MP_MV_EXAMPLE having columns: EMPNO,
ENAME, DEPTNO, TOTAL_SAL, MAX_VAR, MIN_VAR, COUNT_VAR
and SET_VAR.
 TOTAL_SAL = SAL+ COMM + $$BONUS (Bonus is mapping parameter
that changes every month)
 SET_VAR: We will be added one month to the HIREDATE of every
employee.
 Create shortcuts as necessary.

Creating Mapping

1. Open folder where we want to create the mapping.


2. Click Tools -> Mapping Designer.
3. Click Mapping-> Create-> Give name. Ex: m_mp_mv_example
4. Drag EMP and target table.
5. Transformation -> Create -> Select Expression for list -> Create –> Done.
6. Drag EMPNO, ENAME, HIREDATE, SAL, COMM and DEPTNO to
Expression.
7. Create Parameter $$Bonus and Give initial value as 200.
8. Create variable $$var_max of MAX aggregation type and initial value 1500.
9. Create variable $$var_min of MIN aggregation type and initial value 1500.
10.Create variable $$var_count of COUNT aggregation type and initial value 0.
COUNT is visible when datatype is INT or SMALLINT.
11.Create variable $$var_set of MAX aggregation type.

12. Create 5 output ports out_ TOTAL_SAL, out_MAX_VAR, out_MIN_VAR,

out_COUNT_VAR and out_SET_VAR.

13. Open expression editor for TOTAL_SAL. Do the same as we did earlier for
SAL+ COMM. To add $$BONUS to it, select variable tab and select the parameter
from mapping parameter. SAL + COMM + $$Bonus

14. Open Expression editor for out_max_var.


15. Select the variable function SETMAXVARIABLE from left side pane. Select

$$var_max from variable tab and SAL from ports tab as shown
below.SETMAXVARIABLE($$var_max,SAL)

17. Open Expression editor for out_min_var and write the following expression:

SETMINVARIABLE($$var_min,SAL). Validate the expression.

18. Open Expression editor for out_count_var and write the following expression:

SETCOUNTVARIABLE($$var_count). Validate the expression.

19. Open Expression editor for out_set_var and write the following expression:

SETVARIABLE($$var_set,ADD_TO_DATE(HIREDATE,'MM',1)). Validate.

20. Click OK. Expression Transformation below:


21. Link all ports from expression to target and Validate Mapping and Save it.

22. See mapping picture on next page.

PARAMETER FILE

 A parameter file is a list of parameters and associated values for a workflow,


worklet, or session.
 Parameter files provide flexibility to change these variables each time we
run a workflow or session.
 We can create multiple parameter files and change the file we use for a
session or workflow. We can create a parameter file using a text editor such
as WordPad or Notepad.
 Enter the parameter file name and directory in the workflow or session
properties.

A parameter file contains the following types of parameters and variables:

 Workflow variable: References values and records information in a


workflow.
 Worklet variable: References values and records information in a worklet.
Use predefined worklet variables in a parent workflow, but we cannot use
workflow variables from the parent workflow in a worklet.
 Session parameter: Defines a value that can change from session to
session, such as a database connection or file name.
 Mapping parameter and Mapping variable

USING A PARAMETER FILE

Parameter files contain several sections preceded by a heading. The heading


identifies the Integration Service, Integration Service process, workflow, worklet,
or session to which we want to assign parameters or variables.

 Make session and workflow.


 Give connection information for source and target table.
 Run workflow and see result.
Sample Parameter File for Our example:

In the parameter file, folder and session names are case sensitive.

Create a text file in notepad with name Para_File.txt

[Practice.ST:s_m_MP_MV_Example]

$$Bonus=1000

$$var_max=500

$$var_min=1200

$$var_count=0

CONFIGURING PARAMTER FILE

We can specify the parameter file name and directory in the workflow or session
properties.

To enter a parameter file in the workflow properties:


1. Open a Workflow in the Workflow Manager.

2. Click Workflows > Edit.

3. Click the Properties tab.

4. Enter the parameter directory and name in the Parameter Filename field.

5. Click OK.

To enter a parameter file in the session properties:

1. Open a session in the Workflow Manager.

2. Click the Properties tab and open the General Options settings.

3. Enter the parameter directory and name in the Parameter Filename field.

4. Example: D:\Files\Para_File.txt or $PMSourceFileDir\Para_File.txt

5. Click OK.

MAPPLETS
 A mapplet is a reusable object that we create in the Mapplet Designer.
 It contains a set of transformations and lets us reuse that transformation logic
in multiple mappings.
 Created in Mapplet Designer in Designer Tool.

We need to use same set of 5 transformations in say 10 mappings. So instead of


making 5 transformations in every 10 mapping, we create a mapplet of these 5
transformations. Now we use this mapplet in all 10 mappings. Example: To create
a surrogate key in target. We create a mapplet using a stored procedure to create
Primary key for target table. We give target table name and key column name as
input to mapplet and get the Surrogate key as output.

Mapplets help simplify mappings in the following ways:

 Include source definitions: Use multiple source definitions and source


qualifiers to provide source data for a mapping.
 Accept data from sources in a mapping
 Include multiple transformations: As many transformations as we need.
 Pass data to multiple transformations: We can create a mapplet to feed data
to multiple transformations. Each Output transformation in a mapplet
represents one output group in a mapplet.
 Contain unused ports: We do not have to connect all mapplet input and
output ports in a mapping.

Mapplet Input:

Mapplet input can originate from a source definition and/or from an Input
transformation in the mapplet. We can create multiple pipelines in a mapplet.

 We use Mapplet Input transformation to give input to mapplet.


 Use of Mapplet Input transformation is optional.

Mapplet Output:

The output of a mapplet is not connected to any target table.

 We must use Mapplet Output transformation to store mapplet output.


 A mapplet must contain at least one Output transformation with at least one
connected port in the mapplet.

Example1: We will join EMP and DEPT table. Then calculate total salary. Give
the output to mapplet out transformation.

· EMP and DEPT will be source tables.

· Output will be given to transformation Mapplet_Out.

Steps:

1. Open folder where we want to create the mapping.


2. Click Tools -> Mapplet Designer.
3. Click Mapplets-> Create-> Give name. Ex: mplt_example1
4. Drag EMP and DEPT table.
5. Use Joiner transformation as described earlier to join them.
6. Transformation -> Create -> Select Expression for list -> Create -> Done
7. Pass all ports from joiner to expression and then calculate total salary as
described in expression transformation.
8. Now Transformation -> Create -> Select Mapplet Out from list –> Create ->
Give name and then done.
9. Pass all ports from expression to Mapplet output.
10.Mapplet -> Validate
11.Repository -> Save

Use of mapplet in mapping:

 We can mapplet in mapping by just dragging the mapplet from mapplet


folder on left pane as we drag source and target tables.
 When we use the mapplet in a mapping, the mapplet object displays only the
ports from the Input and Output transformations. These are referred to as the
mapplet input and mapplet output ports.
 Make sure to give correct connection information in session.

Making a mapping: We will use mplt_example1, and then create a filter

transformation to filter records whose Total Salary is >= 1500.

· mplt_example1 will be source.

· Create target table same as Mapplet_out transformation as in picture above.


Creating Mapping

1. Open folder where we want to create the mapping.


2. Click Tools -> Mapping Designer.
3. Click Mapping-> Create-> Give name. Ex: m_mplt_example1
4. Drag mplt_Example1 and target table.
5. Transformation -> Create -> Select Filter for list -> Create -> Done.
6. Drag all ports from mplt_example1 to filter and give filter condition.
7. Connect all ports from filter to target. We can add more transformations after
filter if needed.
8. Validate mapping and Save it.

 Make session and workflow.


 Give connection information for mapplet source tables.
 Give connection information for target table.
 Run workflow and see result.

PARTITIONING
 A pipeline consists of a source qualifier and all the transformations and
Targets that receive data from that source qualifier.
 When the Integration Service runs the session, it can achieve higher
Performance by partitioning the pipeline and performing the extract,
Transformation, and load for each partition in parallel.

A partition is a pipeline stage that executes in a single reader, transformation, or


Writer thread. The number of partitions in any pipeline stage equals the number of
Threads in the stage. By default, the Integration Service creates one partition in
every pipeline stage.

PARTITIONING ATTRIBUTES
1. Partition points

 By default, IS sets partition points at various transformations in the pipeline.


 Partition points mark thread boundaries and divide the pipeline into stages.
 A stage is a section of a pipeline between any two partition points.

2. Number of Partitions

 we can define up to 64 partitions at any partition point in a pipeline.


 When we increase or decrease the number of partitions at any partition point,
the Workflow Manager increases or decreases the number of partitions at all
Partition points in the pipeline.
 increasing the number of partitions or partition points increases the number
of threads.
 The number of partitions we create equals the number of connections to the
source or target. For one partition, one database connection will be used.
3. Partition types

 The Integration Service creates a default partition type at each partition


point.
 If we have the Partitioning option, we can change the partition type. This
option is purchased separately.
 The partition type controls how the Integration Service distributes data
among partitions at partition points.

PARTITIONING TYPES
1. Round Robin Partition Type
 In round-robin partitioning, the Integration Service distributes rows of data
evenly to all partitions.
 Each partition processes approximately the same number of rows.
 Use round-robin partitioning when we need to distribute rows evenly and do
not need to group data among partitions.

2. Pass-Through Partition Type

 In pass-through partitioning, the Integration Service processes data without


Redistributing rows among partitions.
 All rows in a single partition stay in that partition after crossing a pass-
Through partition point.
 Use pass-through partitioning when we want to increase data throughput, but
we do not want to increase the number of partitions.

3. Database Partitioning Partition Type

 Use database partitioning for Oracle and IBM DB2 sources and IBM DB2
targets only.
 Use any number of pipeline partitions and any number of database
partitions.
 We can improve performance when the number of pipeline partitions equals
the number of database partitions.

Database Partitioning with One Source

When we use database partitioning with a source qualifier with one source, the
Integration Service generates SQL queries for each database partition and
distributes the data from the database partitions among the session partitions
Equally.

For example, when a session has three partitions and the database has five
partitions, 1st and 2nd session partitions will receive data from 2 database partitions
each. Thus four DB partitions used. 3rd Session partition will receive Data from the
remaining 1 DB partition.

Partitioning a Source Qualifier with Multiple Sources Tables


The Integration Service creates SQL queries for database partitions based on the
Number of partitions in the database table with the most partitions.

If the session has three partitions and the database table has two partitions, one of
the session partitions receives no data.

4. Hash Auto-Keys Partition Type

 The Integration Service uses all grouped or sorted ports as a compound


Partition key.
 Use hash auto-keys partitioning at or before Rank, Sorter, Joiner, and
Unsorted Aggregator transformations to ensure that rows are grouped
Properly before they enter these transformations.

5. Hash User-Keys Partition Type

 The Integration Service uses a hash function to group rows of data among
Partitions.
 we define the number of ports to generate the partition key.
 we choose the ports that define the partition key .

6. Key range Partition Type

 We specify one or more ports to form a compound partition key.


 The Integration Service passes data to each partition depending on the
Ranges we specify for each port.
 Use key range partitioning where the sources or targets in the pipeline are
Partitioned by key range.

Example: Customer 1-100 in one partition, 101-200 in another and so on. We


Define the range for each partition.

INDIRECT LOADING FOR FLAT FILES

Suppose, you have 10 flat files of same structure. All the flat files have same
number of columns and data type. Now we need to transfer all the 10 files to same
target.
Names of files are say EMP1, EMP2 and so on.

Solution1:

1. Import one flat file definition and make the mapping as per need.

2. Now in session give the Source File name and Source File Directory location of
one file.

3. Make workflow and run.

4. Now open session after workflow completes. Change the Filename and
Directory to give information of second file. Run workflow again.

5. Do the above for all 10 files.

Solution2:

1. Import one flat file definition and make the mapping as per need.

2. Now in session give the Source Directory location of the files.

3. Now in Fieldname use $InputFileName. This is a session parameter.

4. Now make a parameter file and give the value of $InputFileName.

$InputFileName=EMP1.txt

5. Run the workflow

6. Now edit parameter file and give value of second file. Run workflow again.

7. Do same for remaining files.

Solution3:

1. Import one flat file definition and make the mapping as per need.

2. Now make a notepad file that contains the location and name of each 10 flat
files.

Sample:
D:\EMP1.txt

E:\EMP2.txt

E:\FILES\DWH\EMP3.txt and so on

3. Now make a session and in Source file name and Source File Directory location
fields, give the name and location of above created file.

4. In Source file type field, select Indirect.

5. Click Apply.

6. Validate Session

7. Make Workflow. Save it to repository and run.

SCD – Type 1
Slowly Changing Dimensions (SCDs) are dimensions that have data that changes
slowly, rather than changing on a time-based, regular schedule

For example, you may have a dimension in your database that tracks the sales
records of your company's salespeople. Creating sales reports seems simple
enough, until a salesperson is transferred from one regional office to another. How
do you record such a change in your sales dimension?

You could sum or average the sales by salesperson, but if you use that to compare
the performance of salesmen, that might give misleading information. If the
salesperson that was transferred used to work in a hot market where sales were
easy, and now works in a market where sales are infrequent, her totals will look
much stronger than the other salespeople in her new region, even if they are just as
good. Or you could create a second salesperson record and treat the transferred
person as a new sales person, but that creates problems also.

Dealing with these issues involves SCD management methodologies:


Type 1:

The Type 1 methodology overwrites old data with new data, and therefore does not
track historical data at all. This is most appropriate when correcting certain types of
data errors, such as the spelling of a name. (Assuming you won't ever need to know
how it used to be misspelled in the past.)
Here is an example of a database table that keeps supplier information:

Supplier_Key Supplier_Code Supplier_Name Supplier_State


123 ABC Acme Supply Co CA

In this example, Supplier_Code is the natural key and Supplier_Key is a surrogate


key. Technically, the surrogate key is not necessary, since the table will be unique
by the natural key (Supplier_Code). However, the joins will perform better on an
integer than on a character string.
Now imagine that this supplier moves their headquarters to Illinois. The updated table would simply
overwrite this record:

Supplier_Key Supplier_Code Supplier_Name Supplier_State


123 ABC Acme Supply Co IL

The obvious disadvantage to this method of managing SCDs is that there is no


historical record kept in the data warehouse. You can't tell if your suppliers are
tending to move to the Midwest, for example. But an advantage to Type 1 SCDs is
that they are very easy to maintain.

Explanation with an Example:

Source Table: (01-01-11) Target Table: (01-01-11)

Emp no Ename Sal


101 A 1000
102 B 2000
103 C 3000
Emp no Ename Sal
101 A 1000
102 B 2000
103 C 3000

The necessity of the lookup transformation is illustrated using the above source
and target table.

Source Table: (01-02-11) Target Table: (01-02-11)

Emp noEname Sal Empno Ename Sal


101 A 1000 101 A 1000
102 B 2500 102 B 2500
103 C 3000 103 C 3000
104 D 4000 104 D 4000
 In the second Month we have one more employee added up to the table with
the Ename D and salary of the Employee is changed to the 2500 instead of
2000.

Step 1: Is to import Source Table and Target table.

 Create a table by name emp_source with three columns as shown above in


oracle.
 Import the source from the source analyzer.
 In the same way as above create two target tables with the names
emp_target1, emp_target2.
 Go to the targets Menu and click on generate and execute to confirm the
creation of the target tables.
 The snap shot of the connections using different kinds of transformations are
shown below.
Step 2: Design the mapping and apply the necessary transformation.

 Here in this transformation we are about to use four kinds of transformations


namely Lookup transformation, Expression Transformation, Filter
Transformation, Update Transformation. Necessity and the usage of all the
transformations will be discussed in detail below.

Look up Transformation: The purpose of this transformation is to determine


whether to insert, Delete, Update or reject the rows in to target table.

 The first thing that we are goanna do is to create a look up transformation


and connect the Empno from the source qualifier to the transformation.
 The snapshot of choosing the Target table is shown below.
 What Lookup transformation does in our mapping is it looks in to the target
table (emp_table) and compares it with the Source Qualifier and determines
whether to insert, update, delete or reject rows.
 In the Ports tab we should add a new column and name it as empno1 and this
is column for which we are gonna connect from the Source Qualifier.
 The Input Port for the first column should be unchked where as the other
ports like Output and lookup box should be checked. For the newly created
column only input and output boxes should be checked.
 In the Properties tab (i) Lookup table name ->Emp_Target.

(ii)Look up Policy on Multiple Mismatch -> use First Value.

(iii) Connection Information ->Oracle.

 In the Conditions tab (i) Click on Add a new condition

(ii)Lookup Table Column should be Empno, Transformation port should be


Empno1 and Operator should ‘=’.
Expression Transformation: After we are done with the Lookup Transformation
we are using an expression transformation to check whether we need to insert the
records the same records or we need to update the records. The steps to create an
Expression Transformation are shown below.

 Drag all the columns from both the source and the look up transformation
and drop them all on to the Expression transformation.
 Now double click on the Transformation and go to the Ports tab and create
two new columns and name it as insert and update. Both these columns are
gonna be our output data so we need to have check mark only in front of the
Output check box.
 The Snap shot for the Edit transformation window is shown below.

 The condition that we want to parse through our output data are listed below.

Input à IsNull(EMPNO1)

Output à iif(Not isnull (EMPNO1) and Decode(SAL,SAL1,1,0)=0,1,0) .

 We are all done here .Click on apply and then OK.


Filter Transformation: we are gonna have two filter transformations one to insert
and other to update.

 Connect the Insert column from the expression transformation to the insert
column in the first filter transformation and in the same way we are gonna
connect the update column in the expression transformation to the update
column in the second filter.
 Later now connect the Empno, Ename, Sal from the expression
transformation to both filter transformation.
 If there is no change in input data then filter transformation 1 forwards the
complete input to update strategy transformation 1 and same output is gonna
appear in the target table.
 If there is any change in input data then filter transformation 2 forwards the
complete input to the update strategy transformation 2 then it is gonna
forward the updated input to the target table.
 Go to the Properties tab on the Edit transformation

(i) The value for the filter condition 1 is Insert.

(ii) The value for the filter condition 1 is Update.

 The Closer view of the filter Connection is shown below.


Update Strategy Transformation: Determines whether to insert, delete, update or
reject the rows.

 Drag the respective Empno, Ename and Sal from the filter transformations
and drop them on the respective Update Strategy Transformation.
 Now go to the Properties tab and the value for the update strategy expression
is 0 (on the 1st update transformation).
 Now go to the Properties tab and the value for the update strategy expression
is 1 (on the 2nd update transformation).
 We are all set here finally connect the outputs of the update transformations
to the target table.

Step 3: Create the task and Run the work flow.

 Don’t check the truncate table option.


 Change Bulk to the Normal.
 Run the work flow from task.

Step 4: Preview the Output in the target table.


SCD 2 (Complete):
Let us drive the point home using a simple scenario. For eg., in the current
month ie.,(01-01-2010) we are provided with an source table with the three
columns and three rows in it like (EMpno,Ename,Sal). There is a new
employee added and one change in the records in the month (01-02-2010). We
are gonna use the SCD-2 style to extract and load the records in to target
table.
 The thing to be noticed here is if there is any update in the salary of any
employee then the history of that employee is displayed with the current date
as the start date and the previous date as the end date.

Source Table: (01-01-11)

Emp no Ename Sal


101 A 1000
102 B 2000
103 C 3000
Target Table: (01-01-11)

Skey Emp no Ename Sal S-date E-date Ver Flag


100 101 A 1000 01-01-10 Null 1 1
200 102 B 2000 01-01-10 Null 1 1
300 103 C 3000 01-01-10 Null 1 1

Source Table: (01-02-11)

Emp no Ename Sal


101 A 1000
102 B 2500
103 C 3000
104 D 4000

Target Table: (01-02-11)

Skey Emp no Ename Sal S-date E-date Ver Flag


100 101 A 1000 01-02-10 Null 1 1
200 102 B 2000 01-02-10 Null 1 1
300 103 C 3000 01-02-10 Null 1 1
201 102 B 2500 01-02-10 01-01-10 2 0
400 104 D 4000 01-02-10 Null 1 1

In the second Month we have one more employee added up to the table with the
Ename D and salary of the Employee is changed to the 2500 instead of 2000.

Step 1: Is to import Source Table and Target table.

 Create a table by name emp_source with three columns as shown above in


oracle.
 Import the source from the source analyzer.
 Drag the Target table twice on to the mapping designer to facilitate insert or
update process.
 Go to the targets Menu and click on generate and execute to confirm the
creation of the target tables.
 The snap shot of the connections using different kinds of transformations are
shown below.

 In The Target Table we are goanna add five columns (Skey, Version, Flag,
S_date ,E_Date).

Step 2: Design the mapping and apply the necessary transformation.

 Here in this transformation we are about to use four kinds of transformations


namely Lookup transformation (1), Expression Transformation (3), Filter
Transformation (2), Sequence Generator. Necessity and the usage of all the
transformations will be discussed in detail below.

Look up Transformation: The purpose of this transformation is to Lookup on the


target table and to compare the same with the Source using the Lookup Condition.

 The first thing that we are gonna do is to create a look up transformation and
connect the Empno from the source qualifier to the transformation.
 The snapshot of choosing the Target table is shown below.
 Drag the Empno column from the Source Qualifier to the Lookup
Transformation.
 The Input Port for only the Empno1 should be checked.
 In the Properties tab (i) Lookup table name ->Emp_Target.

(ii)Look up Policy on Multiple Mismatch -> use Last Value.

(iii) Connection Information ->Oracle.

 In the Conditions tab (i) Click on Add a new condition

(ii)Lookup Table Column should be Empno, Transformation port should be


Empno1 and Operator should ‘=’.

Expression Transformation: After we are done with the Lookup Transformation


we are using an expression transformation to find whether the data on the source
table matches with the target table. We specify the condition here whether to insert
or to update the table. The steps to create an Expression Transformation are shown
below.

 Drag all the columns from both the source and the look up transformation
and drop them all on to the Expression transformation.
 Now double click on the Transformation and go to the Ports tab and create
two new columns and name it as insert and update. Both these columns are
goanna be our output data so we need to have unchecked input check box.
 The Snap shot for the Edit transformation window is shown below.

 The condition that we want to parse through our output data are listed below.

Insert : IsNull(EmpNO1)

Update: iif(Not isnull (Skey) and Decode(SAL,SAL1,1,0)=0,1,0) .

 We are all done here .Click on apply and then OK.

Filter Transformation: We need two filter transformations the purpose the first
filter is to filter out the records which we are goanna insert and the next is vice
versa.

 If there is no change in input data then filter transformation 1 forwards the


complete input to Exp 1 and same output is goanna appear in the target table.
 If there is any change in input data then filter transformation 2 forwards the
complete input to the Exp 2 then it is gonna forward the updated input to the
target table.
 Go to the Properties tab on the Edit transformation

(i) The value for the filter condition 1 is Insert.


(ii) The value for the filter condition 2 is Update.

 The closer view of the connections from the expression to the filter is shown
below.

Sequence Generator: We use this to generate an incremental cycle of sequential


range of number.The purpose of this in our mapping is to increment the skey in the
bandwidth of 100.
 We are gonna have a sequence generator and the purpose of the sequence
generator is to increment the values of the skey in the multiples of 100
(bandwidth of 100).
 Connect the output of the sequence transformation to the Exp 1.

Expression Transformation:

Exp 1: It updates the target table with the skey values. Point to be noticed here is
skey gets multiplied by 100 and a new row is generated if there is any new EMP
added to the list. Else the there is no modification done on the target table.

 Drag all the columns from the filter 1 to the Exp 1.


 Now add a new column as N_skey and the expression for it is gonna be
Nextval1*100.
 We are goanna make the s-date as the o/p and the expression for it is sysdate.
 Flag is also made as output and expression parsed through it is 1.
 Version is also made as output and expression parsed through it is 1.

Exp 2: If same employee is found with any updates in his records then Skey gets
added by 1 and version changes to the next higher number,F

 Drag all the columns from the filter 2 to the Exp 2.


 Now add a new column as N_skey and the expression for it is gonna be
Skey+1.
 Both the S_date and E_date is gonna be sysdate.

Exp 3: If any record of in the source table gets updated then we make it only as the
output.
 If change is found then we are gonna update the E_Date to S_Date.

Update Strategy: This is place from where the update instruction is set on the
target table.

 The update strategy expression is set to 1.

Step 3: Create the task and Run the work flow.

 Don’t check the truncate table option.


 Change Bulk to the Normal.
 Run the work flow from task.
 Create the task and run the work flow.

Step 4: Preview the Output in the target table.


SCD –Type 3:
This Method has limited history preservation, and we are goanna use skey as the
Primary key here.

Source table: (01-01-2011)

Empno Ename Sal


101 A 1000

102 B 2000

103 C 3000

Target Table: (01-01-2011)

Empno Ename C-sal P-sal


101 A 1000 -

102 B 2000 -

103 C 3000 -

Source Table: (01-02-2011)

Empno Ename Sal


101 A 1000
102 B 4566

103 C 3000

Target Table (01-02-2011):

Empno Ename C-sal P-sal


101 A 1000 -

102 B 4566 Null

103 C 3000 -

102 B 4544 4566

So hope u got what I’m trying to do with the above tables:

Step 1: Initially in the mapping designer I’m goanna create a mapping as below.
And in this mapping I’m using lookup, expression, filter, update strategy to drive
the purpose. Explanation of each and every Transformation is given below.

Step 2: here we are goanna see the purpose and usage of all the transformations
that we have used in the above mapping.

Look up Transformation: The look Transformation looks the target table and
compares the same with the source table. Based on the Look up condition it
decides whether we need to update, insert, and delete the data from being loaded in
to the target table.

 As usually we are goanna connect Empno column from the Source Qualifier
and connect it to look up transformation. Prior to this Look up
transformation has to look at the target table.
 Next to this we are goanna specify the look up condition empno =empno1.
 Finally specify that connection Information (Oracle) and look up policy on
multiple mismatches (use last value) in the Properties tab.

Expression Transformation:

We are using the Expression Transformation to separate out the Insert-stuff’s and
Update- Stuff’s logically.

 Drag all the ports from the Source Qualifier and Look up in to Expression.
 Add two Ports and Rename them as Insert, Update.
 These two ports are goanna be just output ports. Specify the below
conditions in the Expression editor for the ports respectively.

Insert: isnull(ENO1 )

Update: iif(not isnull(ENO1) and decode(SAL,Curr_Sal,1,0)=0,1,0)

Filter Transformation: We are goanna use two filter Transformation to filter out
the data physically in to two separate sections one for insert and the other for the
update process to happen.

Filter 1:

 Drag the Insert and other three ports which came from source qualifier in to
the Expression in to first filter.
 In the Properties tab specify the Filter condition as Insert.

Filter 2:
 Drag the update and other four ports which came from Look up in to the
Expression in to Second filter.
 In the Properties tab specify the Filter condition as update.

Update Strategy: Finally we need the update strategy to insert or to update in to


the target table.

Update Strategy 1: This is intended to insert in to the target table.

 Drag all the ports except the insert from the first filter in to this.
 In the Properties tab specify the condition as the 0 or dd_insert.

Update Strategy 2: This is intended to update in to the target table.

 Drag all the ports except the update from the second filter in to this.
 In the Properties tab specify the condition as the 1 or dd_update.

Finally connect both the update strategy in to two instances of the target.

Step 3: Create a session for this mapping and Run the work flow.

Step 4: Observe the output it would same as the second target table
Incremental Aggregation:
When we enable the session option-> Incremental Aggregation the Integration
Service performs incremental aggregation, it passes source data through the
mapping and uses historical cache data to perform aggregation calculations
incrementally.

When using incremental aggregation, you apply captured changes in the source to
aggregate calculations in a session. If the source changes incrementally and you
can capture changes, you can configure the session to process those changes. This
allows the Integration Service to update the target incrementally, rather than
forcing it to process the entire source and recalculate the same data each time you
run the session.

For example, you might have a session using a source that receives new data every
day. You can capture those incremental changes because you have added a filter
condition to the mapping that removes pre-existing data from the flow of data. You
then enable incremental aggregation.

When the session runs with incremental aggregation enabled for the first time on
March 1, you use the entire source. This allows the Integration Service to read and
store the necessary aggregate data. On March 2, when you run the session again,
you filter out all the records except those time-stamped March 2. The Integration
Service then processes the new data and updates the target accordingly.Consider
using incremental aggregation in the following circumstances:

 You can capture new source data. Use incremental aggregation when you
can capture new source data each time you run the session. Use a Stored
Procedure or Filter transformation to process new data.
 Incremental changes do not significantly change the target. Use
incremental aggregation when the changes do not significantly change the
target. If processing the incrementally changed source alters more than half
the existing target, the session may not benefit from using incremental
aggregation. In this case, drop the table and recreate the target with complete
source data.

Note: Do not use incremental aggregation if the mapping contains percentile or


median functions. The Integration Service uses system memory to process these
functions in addition to the cache memory you configure in the session properties.
As a result, the Integration Service does not store incremental aggregation values
for percentile and median functions in disk caches.

Integration Service Processing for Incremental Aggregation

(i)The first time you run an incremental aggregation session, the Integration
Service processes the entire source. At the end of the session, the Integration
Service stores aggregate data from that session run in two files, the index file and
the data file. The Integration Service creates the files in the cache directory
specified in the Aggregator transformation properties.

(ii)Each subsequent time you run the session with incremental aggregation, you
use the incremental source changes in the session. For each input record, the
Integration Service checks historical information in the index file for a
corresponding group. If it finds a corresponding group, the Integration Service
performs the aggregate operation incrementally, using the aggregate data for that
group, and saves the incremental change. If it does not find a corresponding group,
the Integration Service creates a new group and saves the record data.

(iii)When writing to the target, the Integration Service applies the changes to the
existing target. It saves modified aggregate data in the index and data files to be
used as historical data the next time you run the session.

(iv) If the source changes significantly and you want the Integration Service to
continue saving aggregate data for future incremental changes, configure the
Integration Service to overwrite existing aggregate data with new aggregate data.

Each subsequent time you run a session with incremental aggregation, the
Integration Service creates a backup of the incremental aggregation files. The
cache directory for the Aggregator transformation must contain enough disk space
for two sets of the files.

(v)When you partition a session that uses incremental aggregation, the Integration
Service creates one set of cache files for each partition.

The Integration Service creates new aggregate data, instead of using historical data,
when you perform one of the following tasks:

 Save a new version of the mapping.


 Configure the session to reinitialize the aggregate cache.
 Move the aggregate files without correcting the configured path or directory
for the files in the session properties.
 Change the configured path or directory for the aggregate files without
moving the files to the new location.
 Delete cache files.
 Decrease the number of partitions.

When the Integration Service rebuilds incremental aggregation files, the data in the
previous files is lost.

Note: To protect the incremental aggregation files from file corruption or disk
failure, periodically back up the files.

Preparing for Incremental Aggregation:

When you use incremental aggregation, you need to configure both mapping and
session properties:

 Implement mapping logic or filter to remove pre-existing data.


 Configure the session for incremental aggregation and verify that the file
directory has enough disk space for the aggregate files.

Configuring the Mapping

Before enabling incremental aggregation, you must capture changes in source data.
You can use a Filter or Stored Procedure transformation in the mapping to remove
pre-existing source data during a session.

Configuring the Session

Use the following guidelines when you configure the session for incremental
aggregation:

(i) Verify the location where you want to store the aggregate files.

 The index and data files grow in proportion to the source data. Be sure the
cache directory has enough disk space to store historical data for the session.
 When you run multiple sessions with incremental aggregation, decide where
you want the files stored. Then, enter the appropriate directory for the
process variable, $PMCacheDir, in the Workflow Manager. You can enter
session-specific directories for the index and data files. However, by using
the process variable for all sessions using incremental aggregation, you can
easily change the cache directory when necessary by changing
$PMCacheDir.
 Changing the cache directory without moving the files causes the Integration
Service to reinitialize the aggregate cache and gather new aggregate data.
 In a grid, Integration Services rebuild incremental aggregation files they
cannot find. When an Integration Service rebuilds incremental aggregation
files, it loses aggregate history.

(ii) Verify the incremental aggregation settings in the session properties.

 You can configure the session for incremental aggregation in the


Performance settings on the Properties tab.
 You can also configure the session to reinitialize the aggregate cache. If you
choose to reinitialize the cache, the Workflow Manager displays a warning
indicating the Integration Service overwrites the existing cache and a
reminder to clear this option after running the session.

Mapping Templates
Mapping Templates Overview :

A mapping template is a drawing in Visio that represents a PowerCenter mapping.


You can configure rules and parameters in a mapping template to specify the
transformation logic.

Use the Informatica Stencil and the Informatica toolbar in the Mapping Architect
for Visio to create a mapping template. The Informatica Stencil contains shapes
that represent mapping objects that you can use to create a mapping template. The
Informatica toolbar contains buttons for the tasks you can perform on mapping
template.

You can create a mapping template manually, or you can create a mapping
template by importing a Power Center mapping.

Creating a Mapping Template Manually:


You can use the Informatica Stencil and the Informatica toolbar to create a
mapping template. Save and publish a mapping template to create the mapping
template files.

To create a mapping template manually, complete the following steps:

1. Start Mapping Architect for Visio.

2. Verify that the Informatica Stencil and Informatica toolbar are available.

3. Drag the mapping objects from the Informatica Stencil to the drawing
window:- Use the mapping objects to create visual representation of the mapping.

4. Create links:- Create links to connect mapping objects.

5. Configure link rules:- Configure rules for each link in the mapping template to
indicate how data moves from one mapping object to another. Use parameters to
make the rules flexible.

6. Configure the mapping objects:- Add a group or expression required by the


transformations in the mapping template. To create multiple mappings, set a
parameter for the source or target definition.

7. Declare mapping parameters and variables to use when you run sessions in
Power Center:- After you import the mappings created from the mapping
template into Power Center, you can use the mapping parameters and variables in
the session or workflow.

8. Validate the mapping template.

9. Save the mapping template:- Save changes to the mapping template drawing
file.

10. Publish the mapping template:- When you publish the mapping template,
Mapping Architect for Visio generates a mapping template XML file and a
mapping template parameter file (param.xml).If you edit the mapping template
drawing file after you publish it, you need to publish again. Do not edit the
mapping template XML file.

Importing a Mapping Template from a Power Center:


If you have a Power Center mapping that you want to use as a basis for a mapping
template, export the mapping to a mapping XML file and then use the mapping
XML file to create a mapping template.

Note: Export the mapping XML file within the current Power Center release.
Informatica does not support imported objects from a different release.

To import a mapping template from a Power Center mapping, complete the


following steps:

1. Export a Power Center mapping. In the Designer, select the mapping that you
want to base the mapping template on and export it to an XML file.

2. Start Mapping Architect for Visio.

3. Verify that the Informatica stencil and Informatica toolbar are available.

4. Import the mapping. On the Informatica toolbar, click the Create Template
from Mapping XML button. Mapping Architect for Visio determines the mapping
objects and links included in the mapping and adds the appropriate objects to the
drawing window.

5. Verify links. Create or verify links that connect mapping objects.

6. Configure link rules. Configure rules for each link in the mapping template to
indicate how data moves from one mapping object to another. Use parameters to
make the rules flexible.

7. Configure the mapping objects. Add a group or expression required by the


transformations in the mapping template. To create multiple mappings, set a
parameter for the source or target definition.

8. Declare mapping parameters and variables to use when you run the session
in Power Center. After you import the mappings created from the mapping
template into Power Center, you can use the mapping parameters and variables in
the session or workflow.

Note: If the Power Center mapping contains mapping parameters and variables, it
is possible that the mapping parameters and variables ($$ParameterName) may not
work for all mappings you plan to create from the mapping template. Modify or
declare new mapping parameters and variables appropriate for running the new
mappings created from the mapping template.

9. Validate the mapping template.

10. Save the mapping template. Save changes to the mapping template drawing
file.

11. Publish the mapping template. When you publish the mapping template,
Mapping Architect for Visio generates a mapping template XML file and a
mapping template parameter file (param.xml).

If you make any change to the mapping template after publishing, you need to
publish the mapping template again. Do not edit the mapping template XML file.

Note: Mapping Architect for Visio fails to create a mapping template if you import
a mapping that includes an unsupported source type, target type, or mapping
object.

Grid Processing

Grid Processing Overview:

When a Power Center domain contains multiple nodes, you can configure
workflows and sessions to run on a grid. When you run a workflow on a grid, the
Integration Service runs a service process on each available node of the grid to
increase performance and scalability. When you run a session on a grid, the
Integration Service distributes session threads to multiple DTM processes on nodes
in the grid to increase performance and scalability.
You create the grid and configure the Integration Service in the Administration
Console. To run a workflow on a grid, you configure the workflow to run on the
Integration Service associated with the grid. To run a session on a grid, configure
the session to run on the grid.

The Integration Service distributes workflow tasks and session threads based on
how you configure the workflow or session to run:
 Running workflows on a grid. The Integration Service distributes workflows
across the nodes in a grid. It also distributes the Session, Command, and
predefined Event-Wait tasks within workflows across the nodes in a grid.
 Running sessions on a grid. The Integration Service distributes session
threads across nodes in a grid.

Note: To run workflows on a grid, you must have the Server grid option. To run
sessions on a grid, you must have the Session on Grid option.

Running Workflows on a Grid:

When you run a workflow on a grid, the master service process runs the workflow
and all tasks except Session, Command, and predefined Event-Wait tasks, which it
may distribute to other nodes. The master service process is the Integration Service
process that runs the workflow, monitors service processes running on other nodes,
and runs the Load Balancer. The Scheduler runs on the master service process
node, so it uses the date and time for the master service process node to start
scheduled workflows.

The Load Balancer is the component of the Integration Service that dispatches
Session, Command, and predefined Event-Wait tasks to the nodes in the grid. The
Load Balancer distributes tasks based on node availability. If the Integration
Service is configured to check resources, the Load Balancer also distributes tasks
based on resource availability.

For example, a workflow contains a Session task, a Decision task, and a


Command task. You specify a resource requirement for the Session task. The grid
contains four nodes, and Node 4 is unavailable. The master service process runs
the Start and Decision tasks. The Load Balancer distributes the Session and
Command tasks to

nodes on the grid based on resource availability and node availability.

Running Sessions on a Grid:

When you run a session on a grid, the master service process runs the workflow
and all tasks except Session, Command, and predefined Event-Wait tasks as it does
when you run a workflow on a grid. The Scheduler runs on the master service
process node, so it uses the date and time for the master service process node to
start scheduled workflows. In addition, the Load Balancer distributes session
threads to DTM processes running on different nodes.
When you run a session on a grid, the Load Balancer distributes session threads
based on the following factors:

 Node availability :- The Load Balancer verifies which nodes are currently
running, enabled, and available for task dispatch.
 Resource availability :- If the Integration Service is configured to check
resources, it identifies nodes that have resources required by mapping
objects in the session.
 Partitioning configuration. The Load Balancer dispatches groups of
session threads to separate nodes based on the partitioning configuration.

You might want to configure a session to run on a grid when the workflow contains
a session that takes a long time to run.

Grid Connectivity and Recovery

When you run a workflow or session on a grid, service processes and DTM
processes run on different nodes. Network failures can cause connectivity loss
between processes running on separate nodes. Services may shut down
unexpectedly, or you may disable the Integration Service or service processes
while a workflow or session is running. The Integration Service failover and
recovery behavior in these situations depends on the service process that is
disabled, shuts down, or loses connectivity. Recovery behavior also depends on the
following factors:

 High availability option:-When you have high availability, workflows fail


over to another node if the node or service shuts down. If you do not have
high availability, you can manually restart a workflow on another node to
recover it.
 Recovery strategy:- You can configure a workflow to suspend on error. You
configure a recovery strategy for tasks within the workflow. When a
workflow suspends, the recovery behavior depends on the recovery strategy
you configure for each task in the workflow.
 Shutdown mode:- When you disable an Integration Service or service
process, you can specify that the service completes, aborts, or stops
processes running on the service. Behavior differs when you disable the
Integration Service or you disable a service process. Behavior also differs
when you disable a master service process or a worker service process. The
Integration Service or service process may also shut down unexpectedly. In
this case, the failover and recovery behavior depend on which service
process shuts down and the configured recovery strategy.
 Running mode:-If the workflow runs on a grid, the Integration Service can
recover workflows and tasks on another node. If a session runs on a grid,
you cannot configure a resume recovery strategy.
 Operating mode:- If the Integration Service runs in safe mode, recovery is
disabled for sessions and workflows.

Workflow Variables
Workflow Variables Overview:

You can create and use variables in a workflow to reference values and record
information. For example, use a Variable in a Decision task to determine whether
the previous task ran properly. If it did, you can run the next task.

If not, you can stop the workflow. Use the following types of workflow variables:

 Predefined workflow variables. The Workflow Manager provides


predefined workflow variables for tasks within a workflow.
 User-defined workflow variables. You create user-defined workflow
variables when you create a workflow. Use workflow variables when you
configure the following types of tasks:
 Assignment tasks. Use an Assignment task to assign a value to a user-
defined workflow variable. For Example, you can increment a user-defined
counter variable by setting the variable to its current value plus 1.
 Decision tasks. Decision tasks determine how the Integration Service runs a
workflow. For example, use the Status variable to run a second session only
if the first session completes successfully.
 Links. Links connect each workflow task. Use workflow variables in links
to create branches in the workflow. For example, after a Decision task, you
can create one link to follow when the decision condition evaluates to true,
and another link to follow when the decision condition evaluates to false.
 Timer tasks. Timer tasks specify when the Integration Service begins to run
the next task in the workflow. Use a user-defined date/time variable to
specify the time the Integration Service starts to run the next task.

Use the following keywords to write expressions for user-defined and predefined
workflow variables:

 AND
 OR
 NOT
 TRUE
 FALSE
 NULL
 SYSDATE

Predefined Workflow Variables:

Each workflow contains a set of predefined variables that you use to evaluate
workflow and task conditions. Use the following types of predefined variables:

 Task-specific variables. The Workflow Manager provides a set of task-


specific variables for each task in the workflow. Use task-specific variables
in a link condition to control the path the Integration Service takes when
running the workflow. The Workflow Manager lists task-specific variables
under the task name in the Expression Editor.
 Built-in variables. Use built-in variables in a workflow to return run-time or system
information such as folder name, Integration Service Name, system date, or workflow start time.
The Workflow Manager lists built-in variables under the Built-in node in the Expression Editor.

Task-Specific Description Task Data type


Variables Types
Condition Evaluation result of decision Decision Integer
condition expression.
If the task fails, the Workflow
Manager keeps the condition set
to null.
Sample syntax:
$Dec_TaskStatus.Condition =
<TRUE | FALSE | NULL | any
integer>
End Time Date and time the associated task All tasks Date/Time
ended. Precision is to the second.
Sample syntax:
$s_item_summary.EndTime >
TO_DATE('11/10/2004
08:13:25')
ErrorCode Last error code for the associated All tasks Integer
task. If there is no error, the
Integration Service sets
ErrorCode to 0 when the task
completes.
Sample syntax:
$s_item_summary.ErrorCode =
24013.
Note: You might use this variable
when a task consistently fails with
this final error message.
ErrorMsg Last error message for the All tasks Nstring
associated task.If there is no error,
the Integration Service sets
ErrorMsg to an empty string when
the task completes.
Sample syntax:
$s_item_summary.ErrorMsg =
'PETL_24013 Session run
completed with failure
Variables of type Nstring can have
a maximum length of 600
characters.
Note: You might use this variable
when a task consistently fails
with this final error message.
First Error Code Error code for the first error Session Integer
message in the session.
If there is no error, the Integration
Service sets FirstErrorCode to 0
when the session completes.
Sample syntax:
$s_item_summary.FirstErrorCode
= 7086
FirstErrorMsg First error message in the Session Nstring
session.If there is no error, the
Integration Service sets
FirstErrorMsg to an empty string
when the task completes.
Sample syntax:
$s_item_summary.FirstErrorMsg
= 'TE_7086 Tscrubber:
Debug info… Failed to
evalWrapUp'Variables of type
Nstring can have a maximum
length of 600 characters.
PrevTaskStatus Status of the previous task in the All Integer
workflow that the Integration Tasks
Service ran. Statuses include:
1.ABORTED
2.FAILED
3.STOPPED
4.SUCCEEDED
Use these key words when writing
expressions to evaluate the status
of the previous task.
Sample syntax:
$Dec_TaskStatus.PrevTaskStatus
= FAILED
SrcFailedRows Total number of rows the Session Integer
Integration Service failed to read
from the source.
Sample syntax:
$s_dist_loc.SrcFailedRows = 0
SrcSuccessRows Total number of rows successfully Session Integer
read from the sources.
Sample syntax:
$s_dist_loc.SrcSuccessRows >
2500
StartTime Date and time the associated task All Task Date/Time
started. Precision is to the second.

Sample syntax:
$s_item_summary.StartTime >
TO_DATE('11/10/2004
08:13:25')
Status Status of the previous task in the All Task Integer
workflow. Statuses include:
- ABORTED
- DISABLED
- FAILED
- NOTSTARTED
- STARTED
- STOPPED
- SUCCEEDED
Use these key words when writing
expressions to evaluate the status
of the current task.
Sample syntax:
$s_dist_loc.Status =
SUCCEEDED
TgtFailedRows Total number of rows the Session Integer
Integration Service failed to write
to the target.
Sample syntax:
$s_dist_loc.TgtFailedRows = 0
TgtSuccessRows Total number of rows successfully Session Integer
written to the target.
Sample syntax:
$s_dist_loc.TgtSuccessRows > 0
TotalTransErrors Total number of transformation Session Integer
errors.
Sample syntax:
$s_dist_loc.TotalTransErrors = 5

User-Defined Workflow Variables:

You can create variables within a workflow. When you create a variable in a
workflow, it is valid only in that workflow. Use the variable in tasks within that
workflow. You can edit and delete user-defined workflow variables.

Use user-defined variables when you need to make a workflow decision based on
criteria you specify. For example, you create a workflow to load data to an orders
database nightly. You also need to load a subset of this data to headquarters
periodically, every tenth time you update the local orders database. Create separate
sessions to update the local database and the one at headquarters.

Use a user-defined variable to determine when to run the session that updates the
orders database at headquarters.

To configure user-defined workflow variables, complete the following steps:

1. Create a persistent workflow variable, $$WorkflowCount, to represent the


number of times the workflow has run.

2. Add a Start task and both sessions to the workflow.

3. Place a Decision task after the session that updates the local orders database.Set
up the decision condition to check to see if the number of workflow runs is evenly
divisible by 10. Use the modulus (MOD) function to do this.

4. Create an Assignment task to increment the $$WorkflowCount variable by one.

5. Link the Decision task to the session that updates the database at headquarters
when the decision condition evaluates to true. Link it to the Assignment task when
the decision condition evaluates to false. When you configure workflow variables
using conditions, the session that updates the local database runs every time the
workflow runs. The session that updates the database at headquarters runs every
10th time the workflow runs.

Creating User-Defined Workflow Variables :

You can create workflow variables for a workflow in the workflow properties.

To create a workflow variable:

1. In the Workflow Designer, create a new workflow or edit an existing one.

2. Select the Variables tab.

3. Click Add.
4. Enter the information in the following table and click OK:

Field Description
Name Variable name. The correct format is $
$VariableName. Workflow variable names
are not case sensitive.
Do not use a single dollar sign ($) for a
user-defined workflow variable. The single
dollar sign
is reserved for predefined workflow
variables
Data type Data type of the variable. You can select
from the following data types:
- Date/Time
- Double
- Integer
- Nstring

Persistent Whether the variable is persistent. Enable


this option if you want the value of the
variable
retained from one execution of the
workflow to the next.
Default Value Default value of the variable. The
Integration Service uses this value for the
variable during
sessions if you do not set a value for the
variable in the parameter file and there is
no value
stored in the repository.
Variables of type Date/Time can have the
following formats:
- MM/DD/RR
- MM/DD/YYYY
- MM/DD/RR HH24:MI
- MM/DD/YYYY HH24:MI
- MM/DD/RR HH24:MI:SS
- MM/DD/YYYY HH24:MI:SS
- MM/DD/RR HH24:MI:SS.MS
- MM/DD/YYYY HH24:MI:SS.MS
- MM/DD/RR HH24:MI:SS.US
- MM/DD/YYYY HH24:MI:SS.US
- MM/DD/RR HH24:MI:SS.NS
- MM/DD/YYYY HH24:MI:SS.NS
You can use the following separators: dash
(-), slash (/), backslash (\), colon (:), period
(.), and
space. The Integration Service ignores
extra spaces. You cannot use one- or three-
digit values
for year or the “HH12” format for hour.
Variables of type Nstring can have a
maximum length of 600 characters.
Is Null Whether the default value of the variable is
null. If the default value is null, enable this
option.
Description Description associated with the variable.

5. To validate the default value of the new workflow variable, click the Validate
button.
6. Click Apply to save the new workflow variable.

7. Click OK.

Potrebbero piacerti anche