stuck with some Business scenario

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
devesh_ssingh
Participant
Posts: 148
Joined: Thu Apr 10, 2008 12:47 am

stuck with some Business scenario

Post by devesh_ssingh »

We have input;



Cust_Id Policy System Role

1 a b 010
1 a b 020
1 a b 230


2 c d 010
2 c d 020
2 c d 030



3 e f 010
3 e f 230

4 g h 230



We want to take through 020 and 030 as standard so no worries about them.



If there are roles 010 & 230, we only want to take 230.



If we have 010 without a 230, we still want to take through the 010.



Any thoughts? I have highlighted (in bold) the ones we want to retain and the ones in not bold need to be dropped.

Cheers
Devesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What have you designed/tried and how did what you tried fail to meet your expectations? Are you using a version with looping available in the Transformer stage?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
devesh_ssingh
Participant
Posts: 148
Joined: Thu Apr 10, 2008 12:47 am

Post by devesh_ssingh »

Hi Ray,

i am using 8.1 version so no looping there.

i have tried using x'mer by holding previous column value but i need to select between role 010 and 230. there are other column value are also which is not satisfying.

please suggest
bhasds
Participant
Posts: 79
Joined: Thu May 27, 2010 1:49 am

Post by bhasds »

Hi devesh,

You may try the below steps-

1.With the help of filter stage split the records into two stream.

a) Having Role as 20 and 30.
b) Having Role as 10 and 230.

2.Map both the link to a funnel stage.

Sort the link carrying Role as 10 and 230 in decending order taking Cust_Id Policy System as key column and select unique.

The above should get you the desired output. Please let me know if you have any issue.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

just use the good old way, assign a rank using stage variable.

020 and 030 can be sent to one link

on other one sort the data desc order of role.

not assign numbering on the records so that 230 is assigned rank 1 and 010 is assigned rank 2 and rank 1 if 230 is not available and just filter on rank 1.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
bhasds
Participant
Posts: 79
Joined: Thu May 27, 2010 1:49 am

Post by bhasds »

Hi Devesh,

Even you may try this also with a single transformer-

1.Sort the records in the descending order based on the in transformer.

2. In stage variable-

Code: Select all

If Cust_Id <> SV2 Then Cust_Id :" ": Policy:" ": System:" ": Role Else SV1 :" ": Role      SV1
Cust_Id     SV2

3.In derivation constraint-

Code: Select all

Field(SV1," ", Dcount(SV1," ")) ="230" Or Field(SV1," ", Dcount(SV1," ")) ="30" Or 
Field(SV1," ", Dcount(SV1," ")) ="20" Or (Field(SV1," ", Dcount(SV1," ")) ="10" And 
Index(SV1,"230",1) ="0")
Post Reply