Hi all, I have a scenario which I am really having difficulties with. Please do give me any advice where possible.
I have one workflow with 2 tracks split through a decision task. Essentially, what I want is each track will run depending on what a certain flat file content is. If the flat file contains a 'P' it will run track A and if it is 'F' it will run track B.
What I thought of was to use a Decision task and another Session task to do this. The Session will read the flat file containing the 'P' or 'F' and based on that, 'pass' or 'fail' the Session. Depending on this session's status, the decision task will then decide which track to run.
The problem here is I do not know how to 'pass' or 'fail' the session, or is that even possible.
1. create one session which will read flat file and pass data only if contains 'P'. To store this value use a temporary target flat file. If file contains 'P' then targetsuccessrow will be <> 0 and if it contains 'F' then its value will be zero
2. In workflow after this session creata two links for two flows which will have link conditions like
targetsuccessrow will be <> 0 for pass flow
targetsuccessrow will be = 0 for fail flow
In my session, I have a expression transformation which output has this expression: IIF(CHECKVAR = 'P', 'P'). This port then outputs to the target definition.
With this in place, I did away with the decision task and this session is directly linked to the other 2 sessions. I added the link conditions to links as per your advice. However, regardless of whether the flatfile has 'P' or not, it still goes into the TgtSuccessRows <> 0 flow.
Please remove the existing decision task.Decision task is only requierd to validate multiple conditions based on multiple tasks.Based on the condition you can redirect the control flow.
Here in your case decision task is not required as pratik suggested have two link tasks leading to two branches of the workflow and have the link task conditions as suggested by pratik.
Link task 01--- condition ----$s_CONTROL.SrcSuccessRows <> 0
Link task 02--- condition ----$s_CONTROL.SrcSuccessRows = 0
Link task 01 leads to the success branch and other one leads to the failure branch.
**Note : Here the $s_CONTROL is the name of the session created to read the flat file.
hope this may help you....
thanks and regards...
Just to confirm, is it $s_CONTROL.SrcSuccessRows<>0 or $s_CONTROL.TgtSuccessRows<>0?
Furthermore, I have already removed the decision task. However, it is still not working. Could you confirm that in the session that reads the flat file, I have included an Expression Transformation with the expression IIF(CHECKWAR = 'P', 'P'). I have a feeling the issue is the expression. However, I am unsure as to what the solution might be.
$s_CONTROL.TgtSuccessRows=0 for fail flow.
The flow should be similar to this
------s1.status = succeeded-----> track2
Create a mapping name m1 and source the falt file.In the expression provide the below condition
ABORT( IIF( CHECKWAR = 'F','The source row has F value,hence failed',)
Let me know if you face any issues.