Page 1 of 1

Converting column data into Columns and performing count

Posted: Wed May 08, 2019 9:04 am
by nikita.bandekar
Hi , I am a newbie to datastage and stuck on this job since yesterday :(
Can someone help me with this

My data after transforming looks like below:

JobId Status
------------------
7859 Success
7859 Fail
7859 Success
7859 Success


I want my output data to look like:

JobId Success Fail
-------------------------
7859 3 1

The JobId does not differ and is consistent for all the records.

I tried aggregator stage but i am grouping on jobid, status and doing count rows which gives me the below output

JobId Status Count
--------------------------
7859 Success 3
7859 Fail 1

Posted: Wed May 08, 2019 4:28 pm
by ray.wurlod
Now all you need to do is to pivot the data. A Pivot stage should do it, or you could build the logic in a Transformer stage.

Posted: Wed May 08, 2019 7:14 pm
by chulett
Right, that would be a "rows to columns" pivot, a.k.a. a vertical pivot.

Re: Converting column data into Columns and performing count

Posted: Mon May 13, 2019 12:42 pm
by mouthou
If you have a Transformer already in the job, you could use that with LOOPING logic inside the Transformer itself and get the count directly for each JobId (if you find Aggregator and Pivoting combination becomes heavy)