Page 1 of 1

how to create several lines from one line

Posted: Tue Sep 26, 2017 6:47 am
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.

Posted: Tue Sep 26, 2017 7:06 am
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.

Posted: Tue Sep 26, 2017 7:13 am
by tuyenvo
Thank you a lot. I will test your solution :)

Posted: Tue Sep 26, 2017 10:01 am
by tuyenvo
I've just tested it and it works perfectly as expected. Thanks a lot !

Posted: Tue Sep 26, 2017 10:02 am
by chulett
8)