source has 2 fields like
COMPANY LOCATION
IBM HYD
TCS BAN
IBM CHE
HCL HYD
TCS CHE
IBM BAN
HCL BAN
HCL CHE
LIKE THIS.......
AND I WILL GET THE OUTPUT LIKE THIS....
Company loc count
TCS HYD 3
BAN
CHE
IBM HYD 3
BAN
CHE
HCL HYD 3
BAN
CHE
PLZ SEND ME ANSWER FOR THIS QUESTION..........
Answers were Sorted based on User's Feedback
Answer / solomon
2 ways to do it
1- input -> Transformer -> RDP-> output
Sort the input on location, company
do a comparison in Stage Variable with prev record and keep incrementing a counter
pass it via Remove duplicate stage to retain unique records
2- input-> copy-> agrregator-> lookup-> RDP -> output
do the same as above using agg and lookup stage
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sreepathi
Hi
Use stage variables in Transformer stage i.e IF THEN ELSE
IF ..condition comparing companies and use COUNT() function
in transformer for which field u want count
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / saibal kumar giri
Follow below steps-----
1.Read the data with sequential file or connector stage.
2.Use copy stage to streamline the data into two links
a.One data goes to lookup stage.
b.Second stream goes to aggregator stage.
3.In aggregator stage do a count(LOCATION) group by COMPANY.
you will be having data O/P from AGG as below
COMPANY COUNT
TCS 2
HCL 3
IBM 3
Use this output data as the reference link of lookup
stage.Where you have original source as master data.
4.Do a Inner join by lookup stage.
after lookup you will have data like
COMPANY:HCL LOCATION:HYD COUNT:3
COMPANY:HCL LOCATION:CHE COUNT:3
COMPANY:HCL LOCATION:BAN COUNT:3
COMPANY:IBM LOCATION:CHE COUNT:3
COMPANY:IBM LOCATION:BAN COUNT:3
COMPANY:IBM LOCATION:HYD COUNT:3
COMPANY:TCS LOCATION:BAN COUNT:2
COMPANY:TCS LOCATION:CHE COUNT:2
5.Then use a transformer stage along with stage variables
as below
SV1->link1.COMPANY
SV3-> if SV1=SV2 then SET NULL() else link1.COMPANY
SV2->SV1
Similarly for count also
Cheers!!!!!
Is This Answer Correct ? | 0 Yes | 1 No |
eno ename 1 qaz 1 wsx 1 edc 2 zxc 2 asd 3 qwe 3 wer 3 tru 4 rgj Output: eno ename count 1 qaz,wsx,edc 3 2 zxc,asd 2 3 qwe,wer,tru 3 4 rgj 1 I want the above output to be solved by DataStage as well and I have to write SQL query for the same output.
What is the difference between operational data stage (ods) and data warehouse?
I have a few records just I want to store data in to targets cycling way how?
What is the difference between informatica and datastage?
my source seq file have col1 1 2 3 4 5 6 7 8 9 i have 4 targets t1 t2 t3 t4 1 2 3 4 5 6 7 8 9 like this how we can get?
How to work with XML out put stage? Please explain step by step? i need to generate XML file using Table data. Given is the .XSD file. Please help?
How a server job can be converted to a parallel job?
if a column contains data like ram,rakesh,madhan,suraj,pradeep,bhaskar then I want to place names separated by commas in another columns how can we do?
how to find no.of records in sequntial file itself?
I am having two tables called MASTER and DETAIL. I want to insert records to both tables. But one condition is that whenever the insert for MASTER table is success then only the records will inserted into the DETAIL table, otherwise abort the job. How can u design this job?
Whats difference betweeen operational data stage (ods) and data warehouse?
How to use Environment variable's in datastage?(use of process)