Scenario:
Load the session statistics such as Session Start & End Time, Success Rows, Failed Rows and Rejected Rows etc. into a database table for audit/log purpose.
Solution:
After performing the below solution steps your end workflow will look as follows:
START => SESSION1 => ASSIGNMENT TASK => SESSION2
SOLUTION STEPS
SESSION1
This session is used to achieve your actual business logic. Meaning this session will perform your actual data load. It can be anything File Table.à File or Tableà Table, File Ã
WORKFLOW VARIABLES
Create the following workflow variables.
=> $$Workflowname
=> $$SessionStartTime
=> $$SessionEndTime
=> $$TargetSuccessrows
=> $$TargetFailedRows
ASSIGNMENT TASK
Use the Expression tab in the Assignment Task and assign as follows:
$$workflowname = $PMWorkflowName
$$sessionStartTime = $ SESSION1.StartTime
$$SessionEndTime = $ SESSION1.Endtime
$$ TargetSuccessrows = $ SESSION1. TgtSuccessRows
$$ TargetFailedRows = $ SESSION1. TgtFailedRows
SESSION2
This session is used to load the session statistics into a database table.
=> This should call a mapping say ‘m_sessionLog’
=> This mapping m_sessionLog should have mapping variables for the above defined workflow variables such as $$wfname, $$Stime, $$Etime, $$TSRows and $$TFRows.
=> This mapping m_sessionLog should use a dummy source and it must have a expression transformation and a target => database Audit table)
=> Inside the expression you must assign the mapping variables to the output ports
workflowname=$$wfname
starttime=$$Stime
endtime=$$Etime
SucessRows=$$TSRows
FailedRows=$$TFRows
=> Create a target database table with the following columns
Workflowname, start time, end time, success rows and failed rows.
=> Connect all the required output ports to the target which is nothing but your audit table.
PRE-Session Variable
=> Session 2: In the Pre-session variable assignment tab assign the mapping variable = workflow variable
=> In our case
$$wfname=$$workflowname
$$Stime=$$sessionStartTime
$$Etime=$$sessionEndTime
$$TSRows=$$TargetSuccessrows
$$TFRows=$$TargetFailedrows
Workflow Execution
Load the session statistics such as Session Start & End Time, Success Rows, Failed Rows and Rejected Rows etc. into a database table for audit/log purpose.
Solution:
After performing the below solution steps your end workflow will look as follows:
START => SESSION1 => ASSIGNMENT TASK => SESSION2
SOLUTION STEPS
SESSION1
This session is used to achieve your actual business logic. Meaning this session will perform your actual data load. It can be anything File Table.à File or Tableà Table, File Ã
WORKFLOW VARIABLES
Create the following workflow variables.
=> $$Workflowname
=> $$SessionStartTime
=> $$SessionEndTime
=> $$TargetSuccessrows
=> $$TargetFailedRows
ASSIGNMENT TASK
Use the Expression tab in the Assignment Task and assign as follows:
$$workflowname = $PMWorkflowName
$$sessionStartTime = $ SESSION1.StartTime
$$SessionEndTime = $ SESSION1.Endtime
$$ TargetSuccessrows = $ SESSION1. TgtSuccessRows
$$ TargetFailedRows = $ SESSION1. TgtFailedRows
SESSION2
This session is used to load the session statistics into a database table.
=> This should call a mapping say ‘m_sessionLog’
=> This mapping m_sessionLog should have mapping variables for the above defined workflow variables such as $$wfname, $$Stime, $$Etime, $$TSRows and $$TFRows.
=> This mapping m_sessionLog should use a dummy source and it must have a expression transformation and a target => database Audit table)
=> Inside the expression you must assign the mapping variables to the output ports
workflowname=$$wfname
starttime=$$Stime
endtime=$$Etime
SucessRows=$$TSRows
FailedRows=$$TFRows
=> Create a target database table with the following columns
Workflowname, start time, end time, success rows and failed rows.
=> Connect all the required output ports to the target which is nothing but your audit table.
PRE-Session Variable
=> Session 2: In the Pre-session variable assignment tab assign the mapping variable = workflow variable
=> In our case
$$wfname=$$workflowname
$$Stime=$$sessionStartTime
$$Etime=$$sessionEndTime
$$TSRows=$$TargetSuccessrows
$$TFRows=$$TargetFailedrows
Workflow Execution
Thank you kareem...can you explain below scenaro.
ReplyDelete-->in first session run shoud load half records to target and second session run should load scecond hlf records to target
Good infromation about session statistics
ReplyDeleteinformatica training, informatica training in bangalore , informatica online training , informatica online training in bangalore
how can we implement this for a list of 100 workflows
ReplyDelete