how to create several lines from one line

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
tuyenvo
Participant
Posts: 3
Joined: Tue Sep 26, 2017 6:21 am

how to create several lines from one line

Post by tuyenvo »

Hello every body

I'm new in Datastage PX. I have to do a job but i have no idea how to do it.
That is my specifications :

Let's say I have in the source table these columns with these values :
RETAILER_ID; TSHIRT_SALES; TROUSER_SALE; PULL_SALES
0001; 500; 600; 450;
0002; 0; 35; 750;

and I'd like to transform it in another table where the data should look like this :

RETAILER_ID PRODUCT_TYPE SALES
0001 T-Shirt 500
0001 Trouser 600
0001 Pull 450
0002 T-Shirt 0
0002 Trouser 35
0002 Pull 750

If you have any advice, I will be very thankful.

Regards.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Welcome.

That is a horizontal pivot of columns to rows and there is a Pivot stage to help with that. The only extra thing you would need to do is add three columns before you do that, hard-coded to have your three PRODUCT_TYPE values, so they can be pivoted as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
tuyenvo
Participant
Posts: 3
Joined: Tue Sep 26, 2017 6:21 am

Post by tuyenvo »

Thank you a lot. I will test your solution :)
tuyenvo
Participant
Posts: 3
Joined: Tue Sep 26, 2017 6:21 am

Post by tuyenvo »

I've just tested it and it works perfectly as expected. Thanks a lot !
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

8)
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply