How to insert row at runtime

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
sanjeeva999
Participant
Posts: 4
Joined: Mon Sep 18, 2006 9:28 am

How to insert row at runtime

Post by sanjeeva999 »

Hi Friends,

I want to insert row at runtime by using datastage.

EX. SOURCEI

ID NAME SALARY
--- ------- -------------
1 A 100
2 B 300
3 C 400


TARGET
--------
ID NAME SALARY


MAPPING(SOURCE TO TARGET)
---------------------------------------

ID -------------> . ID

NAME------------> NAME
SALARY------------->SALARY

MY RESULT SHOULD LIKE THIS

ID NAME SALARY
--- ------- -------------
1 A 100
2 B 300
3 C 400
NULL NULL 800(100+300+400) I AM ADDING FIRST THREE ROWS).

If u any body knows about this logic,can u send to me.
ok




---------
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Put a copy stage after the source and get two links. Link1 -> Transformer1 -> aggregator -> Transformer2 -> Funnel. Link2 -> Funnel. In transformer1 generate a dummy field. In the aggregator stage group by dummy key and map only the ID and NAME fields. The third field will be the sum field. In transformer2 generate NULL for the first 2 fields and rename the sum field to SALARY. In the funnel stage Set funnel type to sequential and specify Link2 as the first link and the link from transformer2 as the second. Might get warnings due to Nullability or data type. And also for this to work the fields ID and NAME should be Nullable Yes fields.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You've posted in an improper forum. This one is for discussion of posible FAQ topics, not for solving job problems. Here we don't know anything about your installation or even if you are seeking a Server or PX solution. :?

Maveric has assumed PX. Please let us know which job type you have so the Moderator can place this in the proper forum. Either that or repost the question where it belongs based on the job type.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sanjeeva999
Participant
Posts: 4
Joined: Mon Sep 18, 2006 9:28 am

Thanks

Post by sanjeeva999 »

Thank u for ur Information.
i got it.
Maveric wrote:Put a copy stage after the source and get two links. Link1 -> Transformer1 -> aggregator -> Transformer2 -> Funnel. Link2 -> Funnel. In transformer1 generate a dummy field. In the aggregator stage group by dummy key and map only the ID and NAME fields. The third field will be the sum field. In transformer2 generate NULL for the first 2 fields and rename the sum field to SALARY. In the funnel stage Set funnel type to sequential and specify Link2 as the first link and the link from transformer2 as the second. Might get warnings due to Nullability or data type. And also for this to work the fields ID and NAME should be Nullable Yes fields.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

If that is the solution you are looking, then it is time to mark the topic as resolved
Post Reply