Converting multiple records into one
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
Converting multiple records into one
I got the data like this :
ID,Code,Value
001,item1,a1
001,item3,a2
001,item4,a3
001,item8,a4
002,item1,b1
002,item5,b2
002,item6,b3
My expected output is :
ID,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8
001,a1,Null,a3,a4,Null,Null,Null,a4
002,b1,Null,Null,Null,b2,b3,Null,Null
Is it possible to do in transformer stage using loop or stage variable ??
I read some thread on similar scenario mentioned about pivot stage , is it only available in Data Stage , because i using Quality Stage 8.5 and can't find this item.
Thank you.
ID,Code,Value
001,item1,a1
001,item3,a2
001,item4,a3
001,item8,a4
002,item1,b1
002,item5,b2
002,item6,b3
My expected output is :
ID,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8
001,a1,Null,a3,a4,Null,Null,Null,a4
002,b1,Null,Null,Null,b2,b3,Null,Null
Is it possible to do in transformer stage using loop or stage variable ??
I read some thread on similar scenario mentioned about pivot stage , is it only available in Data Stage , because i using Quality Stage 8.5 and can't find this item.
Thank you.
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
You mean this ? "Loop example: multiple repeating values in a single field"qt_ky wrote:Transformer stage loop should work as well. The product documentation has good loop examples.
Actually my data is already in db2 format , each value represent a value within a column , no longer a comma-separated values.
Anyway to capture it ? Because the example is separate the value by detecting "/".
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
QualityStage adds "data quality" stages to your DataStage Designer palette. If you check under the "processing" palette category, you should find the Pivot stage. You can mix and match DS & QS stages in the same job design.
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Regarding the loop, a little further down there is another example, "Input row group aggregation included with input row data." Not that you want to aggregate in your case, but I'm just saying I think what you want to do is possible with a loop. You can get very creative with loops. However, they can become convoluted, so using a Pivot stage is going to be more straight-forward! It won't matter if your input comes from a file or from DB2.
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
Ray ,
i know this section is about DataStage , however i believe my current scenario is more towards DataStage rather than QualityStage. And i already stated that im using QualityStage 8.5 in my first post.
Eric ,
actually i am not familiar on how the transformer loop works but i will try it out.
Currently i tried to achieve it as below :
First , i transform my data into something like this :
ID ITEM1 ITEM2 ITEM3 ITEM4 ITEM5
1 a1 "" "" "" ""
1 "" a2 "" "" ""
1 "" "" "" "" a3
Then i output it into a aggregator stage to select the Max values of each column so my data will be something like this :
ID ITEM1 ITEM2 ITEM3 ITEM4 ITEM5
1 a1 a2 "" "" a3
However, after i found out that aggregator stage only support Integer/Decimal value ? Some of my data which contains char become 0 at the output stage.
i know this section is about DataStage , however i believe my current scenario is more towards DataStage rather than QualityStage. And i already stated that im using QualityStage 8.5 in my first post.
Eric ,
actually i am not familiar on how the transformer loop works but i will try it out.
Currently i tried to achieve it as below :
First , i transform my data into something like this :
ID ITEM1 ITEM2 ITEM3 ITEM4 ITEM5
1 a1 "" "" "" ""
1 "" a2 "" "" ""
1 "" "" "" "" a3
Then i output it into a aggregator stage to select the Max values of each column so my data will be something like this :
ID ITEM1 ITEM2 ITEM3 ITEM4 ITEM5
1 a1 a2 "" "" a3
However, after i found out that aggregator stage only support Integer/Decimal value ? Some of my data which contains char become 0 at the output stage.
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
I look through "Data Quality" and "Procssing" palette but i could not find Pivot Stage.qt_ky wrote:QualityStage adds "data quality" stages to your DataStage Designer palette. If you check under the "processing" palette category, you should find the Pivot stage. You can mix and match DS & QS stages in the same job design.
And i do a quick find on Pivot then i found a Pivot and Pivot Entreprise Stage. But it is Read Only and i could not drag it into my job.
Thanks
Do you have a local admin to check with? How about support? Sounds like you've got problems...
Try right-clicking on the palette and exploring options to load defaults or reset to factory default settings.
If your job type is Parallel job, then the Processing category should show Pivot and Pivot Enterprise stage types, and allow you to put those into your job design.
I suggest you focus on getting a Pivot stage to work rather than going down the loop path.
Try right-clicking on the palette and exploring options to load defaults or reset to factory default settings.
If your job type is Parallel job, then the Processing category should show Pivot and Pivot Enterprise stage types, and allow you to put those into your job design.
I suggest you focus on getting a Pivot stage to work rather than going down the loop path.
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 63
- Joined: Mon Sep 12, 2011 2:11 am
already solve the problem using loop condition under transformer stage.
i make the data into :
ID,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8
001,a1,Null,null,null,Null,Null,Null,null
001,a1,Null,a2,null,Null,Null,Null,null
001,a1,Null,a2,a3,Null,Null,Null,null
001,a1,Null,a2,a3,Null,Null,Null,a4
then filter last row of each group using NumSavedRows and NumRows provided in product documentation.
i make the data into :
ID,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8
001,a1,Null,null,null,Null,Null,Null,null
001,a1,Null,a2,null,Null,Null,Null,null
001,a1,Null,a2,a3,Null,Null,Null,null
001,a1,Null,a2,a3,Null,Null,Null,a4
then filter last row of each group using NumSavedRows and NumRows provided in product documentation.