Set the priority for the input records
Originally posted by: Arunn
Hi,
I have a scenario to set the priority for the incoming records and initialize the column value based on the priority as shown below
File 1 :
EmpNo, Dept, DeptNo
101, Mech, 100
102, Civil, 200
103, Mech, 100
104, Comp, 300 -> 1st Prioirty
104, Comp, 400 -> 2nd Prioirty
File 2 :
EmpNo,Name, Address, Company
101,AAA,sssss, Company1
102,BBB,sssss, Company2
103,CCC,sssss, Company3
104,DDD,sssss, Company4
105,EEE,sssss, Company5
Expected Output :
EmpNo,Name, Address, Company, Dept, DeptNo
101,AAA,sssss, Company1, Mech,100
102,BBB,sssss, Company2, Civil,200
103,CCC,sssss, Company3, Mech,100
104,DDD,sssss, Company4, Comp,300 - I want to set the priority for DeptNo 300, if it's not avaible then I will fecth the DeptNo 400 for Dept Computer.
105,EEE,sssss, Company5, null,null
Hi,
I have a scenario to set the priority for the incoming records and initialize the column value based on the priority as shown below
File 1 :
EmpNo, Dept, DeptNo
101, Mech, 100
102, Civil, 200
103, Mech, 100
104, Comp, 300 -> 1st Prioirty
104, Comp, 400 -> 2nd Prioirty
File 2 :
EmpNo,Name, Address, Company
101,AAA,sssss, Company1
102,BBB,sssss, Company2
103,CCC,sssss, Company3
104,DDD,sssss, Company4
105,EEE,sssss, Company5
Expected Output :
EmpNo,Name, Address, Company, Dept, DeptNo
101,AAA,sssss, Company1, Mech,100
102,BBB,sssss, Company2, Civil,200
103,CCC,sssss, Company3, Mech,100
104,DDD,sssss, Company4, Comp,300 - I want to set the priority for DeptNo 300, if it's not avaible then I will fecth the DeptNo 400 for Dept Computer.
105,EEE,sssss, Company5, null,null
-
Originally posted by: stonysmith
This should do what you want.
It matches the Employee to BOTH priorities, and then uses Duplicate Detection to find the ones that did have more than one priority.
It then uses an AGG to take the lowest (#1) priority for each Employee.
node:Static_Data bretype:core::Static Data editor:sortkey=5b1575290dc53941 output:@40fe6c55598828e5/= prop:StaticData=<<EOX EmpNo,Dept,DeptNo 101,Mech,100 102,Civil,200 103,Mech,100 104,Comp,300 104,Comp,400 EOX editor:XY=110,140 end:Static_Data node:Set_Priority bretype:core::Sort editor:Label=Set Priority editor:sortkey=5b15765d10f12893 input:@40fd2c743ebf4304/=Static_Data.40fe6c55598828e5 output:@40fd2c746a2a3b47/= prop:CompareOrderExpr=<<EOX EmpNo,DeptNo EOX editor:XY=200,140 end:Set_Priority node:XRef bretype:core::X-Ref editor:sortkey=5b1575443e201c16 input:@45781ca80c2802d0/=Set_Priority.40fd2c746a2a3b47 input:@45781ca971fe502f/=Static_Data_3.40fe6c55598828e5 output:@45781cad02e051b0/= output:@457826825d7c2de0/= output:@4578268450ad5d88/= prop:LeftInputKey=<<EOX EmpNo EOX prop:RightInputKey=<<EOX EmpNo EOX prop:SortLeftInput=true prop:SortRightInput=true editor:XY=310,170 node:Sort_2 bretype:::Sort editor:shadow=45782670131b71e8 input:@40fd2c743ebf4304/= output:@40fd2c746a2a3b47/= end:Sort_2 node:Bypass_3 bretype:::Bypass editor:shadow=4578267017753cec input:@45782010749f0c96/= input:@457820124fef7658/= output:@40fd2c7436717256/= end:Bypass_3 node:Join bretype:::Join editor:shadow=457826701862249e input:@40fd2c745b6d7704/= input:@40fd2c74504921cd/= output:@40fd2c7430f76546/= output:@457826cc03a465f4/= output:@457826cc510c69e0/= end:Join node:Bypass bretype:::Bypass editor:shadow=4578267041681261 input:@45782010749f0c96/= input:@457820124fef7658/= output:@40fd2c7436717256/= end:Bypass node:Sort bretype:::Sort editor:shadow=4578267075a60d09 input:@40fd2c743ebf4304/= output:@40fd2c746a2a3b47/= end:Sort end:XRef node:Duplicate_Detection bretype:core::Duplicate Detection editor:sortkey=5b15756f06eb3eb9 input:@412b51602ae908b4/=XRef.457826825d7c2de0 output:@412b51604cbd4212/= output:@45770db33b314718/= prop:ErrorIfDuplicates=false prop:InputExpr=<<EOX EmpNo EOX editor:XY=420,170 node:Error_if_dups_found bretype:::Error if dups found editor:shadow=45770da20c26095b input:@40fd2c74167f1ca2/= output:@40fd2c7420761db6/= end:Error_if_dups_found node:sort bretype:::Sort editor:shadow=45770da245f22c38 input:@40fd2c743ebf4304/= output:@40fd2c746a2a3b47/= end:sort node:Join bretype:::Join editor:shadow=45771849435f233f input:@40fd2c745b6d7704/= input:@40fd2c74504921cd/= output:@40fd2c7430f76546/= output:@457720e45ed701a9/= end:Join node:Agg bretype:::Agg editor:shadow=45772d9e1f7c1166 input:@40fd2c7427456e5b/= output:@40fd2c744c862db0/= end:Agg end:Duplicate_Detection node:Static_Data_3 bretype:core::Static Data editor:sortkey=5b1575347f2026f7 output:@40fe6c55598828e5/= prop:StaticData=<<EOX EmpNo,Name,Address,Company 101,AAA,sssss,Company1 102,BBB,sssss,Company2 103,CCC,sssss,Company3 104,DDD,sssss,Company4 105,EEE,sssss,Company5 EOX editor:XY=190,230 end:Static_Data_3 node:Select_First bretype:core::Agg editor:Label=Select First editor:sortkey=5b15758b78ad326b input:@40fd2c7427456e5b/=Duplicate_Detection.45770db33b314718 output:@40fd2c744c862db0/= prop:GroupBy=<<EOX EmpNo EOX prop:Script=<<EOX emit * where firstInGroup EOX editor:XY=520,180 end:Select_First node:Cat bretype:core::Cat editor:sortkey=5b1575a874657d00 input:@40fd2c7476b11c42/=Duplicate_Detection.412b51604cbd4212 input:5b1575b051105728/out1=Select_First.40fd2c744c862db0 output:@40fd2c74676e03c3/= editor:XY=620,170 end:Cat
Please sign in to leave a comment.
Comments
1 comment