Hi guys,
please design job for this,
MY INPUT IS
COMPANY,LOCATION
IBM,CHENNAI
IBM,HYDRABAD
IBM,PUNE
IBM,BANGLOORE
TCS,CHENNAI
TCS,MUMBAI
TCS,BANGLOORE
WIPRO,HYDRABAD
WIPRO,CHENNAI
HSBC,PUNE
MY OUTPUT IS
COMPANY,LOCATION,COUNT
IBM,chennai,hydrabad,pune,banglore,4
TCS,chennai,mumbai,bangloore,3
WIPRO,hydrabad,chennai,2
HSBC,pune,1
Thanks
Answers were Sorted based on User's Feedback
Answer / ankit gosain
Hi All,
Create a job design like below:
SeqFile--->SortStage--->Transformer--->RemoveDup--->SeqFile
Steps:
-----
1. At sort stage, take sort key = Company and sort key mode
= Don't sort (Previously Grouped) & take a
CreateClusterKeyChange column.
2. At Transformer Stage, create two stage variables:
temp of integer type with 0 as default,
temp1 of varchar type.
now, write in their derivation:
if clusterKeyChange=1 then 1 else temp+1----temp
if clusterKeyChange=1 then Location else temp1:',':Location-
---temp1
Create one o/p column (say count).
Now derive the o/p derivation columns as:
Company--------Company
temp1----------Location
temp-----------Count
3. At remove duplicate stage, take key=Company and
Duplicate to retain = Last
now just drag and drop the i/p columns to o/p derivation
& you will get the desired result.
For further queries, mail me on ankitgosain@gmail.com
Cheers,
Ankit :)
Is This Answer Correct ? | 14 Yes | 0 No |
what Ankit explained is correct. but small correction:
as per abouve explanation we get o/p location as below:
LOCATION
,chennai,hydrabad,pune,banglore
,chennai,mumbai,bangloore
,hydrabad,chennai
,pune
So, we need to do LTRIM/TRIM Function in devivation of the
column:
TRIM(temp1,',')---------->Location
then we get desired output.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / raj
There are two requirements here
1. Counting
2. Converting rows to columns
Here is the design of the job
Source -> Pivot(Vertical) -> Transformer -> Destination
Pivot:
1. Use vertical pivot.
2. Mention Company as Group by column and Location as pivot. In the aggregate column choose count
Transformer:
1. Above pivoting gives locations in different columns. Use transformer to concatenate these columns using : operator
Is This Answer Correct ? | 0 Yes | 0 No |
When we will go for Data elements?
How complex jobs are implemented in datstage to improve performance?
Can you explain engine tier in information server?
Hi any one has datasatge 8.5 certication dump could you please provide your details i will contact you. send reply to my mail rajaadivi@gmail.com Thanks in Advance
How one source columns or rows to be loaded in to two different tables?
source contains 2 columns comes to target 4 columns how
if we take 2 tables(like emp and dept), we use join stage and how to improve the performance?
What are routines in datastage?
What is the different type of jobs in datastage?
Describe routines in datastage? Enlist various types of routines.
Demonstrate experience in maintaining quality process standards?
Distinguish between informatica & datastage. Which one would you choose and why?