Transformer Constraint and Rejects
Moderators: chulett, rschirm, roy
Transformer Constraint and Rejects
Hi,
I have this question. I have an input to transformer, and I want to reject few coming in based on few criteria, and the rest would be deviated thru various output links based on various constraints..How do i go about it.
The REST are those that don't match the criteria for the rejects.
Thanks
Vijay
I tried Reject[as an Ouptut1 link] and rest were defined as Otherwise with different constraint. but this didn't seem to work..still trying it out.
Any help is appreciated.
I have this question. I have an input to transformer, and I want to reject few coming in based on few criteria, and the rest would be deviated thru various output links based on various constraints..How do i go about it.
The REST are those that don't match the criteria for the rejects.
Thanks
Vijay
I tried Reject[as an Ouptut1 link] and rest were defined as Otherwise with different constraint. but this didn't seem to work..still trying it out.
Any help is appreciated.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The Otherwise/Log output must be executed AFTER all other output links (except the Reject link, if you have one). Use the output link execution order tool (rightmost on the Transformer stage toolbar) to ensure that this is so.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
Say reject criteria is Cond 1 OR [Cond 2 And Cond3]=Reject outputus1aslam1us wrote:You can specify the constraints for all the output links then for the last link check mark as the reject.
Or specify the constraints and someone will set it up for you.
Sam
For any other conditions other than the reject criteria, I need to deviate to Output 1 when Field 1=1
Output 2 when Field 2 =2
Output 3 when Field 3 =3
For records that meet the reject criteria, it might carry Field1=1 or Field2=2 or Field3=3 and I want these records tobe only rejected, and not Reject AND also flow thru other output links. {Hope I didn't confuse}
-
- Participant
- Posts: 56
- Joined: Mon Oct 16, 2006 7:32 am
One way is not to have a reject link ,but to have the reject critireon as the constraint in one of the output links .That will work .
create a stage flag1. Have the expression return 0 if false otherwise return 1
eg:
IF cond1 or (cond2 =2 and cond3=3) then 1 else 0
For the 4 output link write constraints as follows
If flag1=0 and Field 1=1 then @TRUE else @FALSE
If flag1=0 and Field 2=2 then @TRUE else @FALSE
If flag1=0 and Field 3=3 then @TRUE else @FALSE
If flag1=0 then @TRUE else @FALSE ( this will have the rejected records,without designating the link as reject link)
create a stage flag1. Have the expression return 0 if false otherwise return 1
eg:
IF cond1 or (cond2 =2 and cond3=3) then 1 else 0
For the 4 output link write constraints as follows
If flag1=0 and Field 1=1 then @TRUE else @FALSE
If flag1=0 and Field 2=2 then @TRUE else @FALSE
If flag1=0 and Field 3=3 then @TRUE else @FALSE
If flag1=0 then @TRUE else @FALSE ( this will have the rejected records,without designating the link as reject link)
JT
You all do realize that this 'if then else' to simply set something to true or false is completely unnecessary, yes? Derivations can be expressions that automatically resolve to true or false without all the shenanigans. For example:johnthomas wrote:If flag1=0 and Field 1=1 then @TRUE else @FALSE
If flag1=0 and Field 2=2 then @TRUE else @FALSE
If flag1=0 and Field 3=3 then @TRUE else @FALSE
If flag1=0 then @TRUE else @FALSE
Gets you the same results. Which also means that if you use this to set something like a Stage Variable to a boolean value that you also don't have to explicitly test against @TRUE either...me wrote:flag1=0 and Field 1=1
flag1=0 and Field 2=2
flag1=0 and Field 3=3
flag1=0
If svFred = @TRUE Then 'Y' Else 'N'
Can be expressed as:
If svFred Then 'Y' Else 'N'
Check for @FALSE by 'not'ing the expression:
If Not(svFred) Then 'N' Else 'Y'
FYI.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 56
- Joined: Mon Oct 16, 2006 7:32 am
Good suggestion chullett . I guess that is more appropriate in his case. He can use this approach in case all records rejected are not getting processed . I prefer the other approach since i need to process some of the records which are also rejected , so that we can report those as data which has defects but is that of different (lower ) exception level than the normal rejects . We dont do seperate data profiling , hence this approach
JT
Thank you both. In my case, I want certain records to be rejected and not processed at all, while the ones that weren't rejected to be processed. Appreciate your helpjohnthomas wrote:Good suggestion chullett . I guess that is more appropriate in his case. He can use this approach in case all records rejected are not getting processed . I prefer the other approach since i need to process some of the records which are also rejected , so that we can report those as data which has defects but is that of different (lower ) exception level than the normal rejects . We dont do seperate data profiling , hence this approach
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
So your non-reject links lead into other stage types that process them, while your Otherwise/Log link leads somewhere (a Sequential File stage perhaps, or a Copy stage with no outputs) where nothing happens.
Or, if you simply want to discard these input rows, have no Otherwise/Log and no Reject link at all.
Or, if you simply want to discard these input rows, have no Otherwise/Log and no Reject link at all.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.