Numeric Sequence

Six Stars

Numeric Sequence

I have an excel input file with customer names, and I am trying to generate sequence numbers. This is what I am getting right now

CustomerName              SequenceGenerated

ABC                                 P1001

ABC                                 P1002

XYZ                                 P1003

 

But the output I want is as follows:

CustomerName              SequenceGenerated

ABC                                 P1001

ABC                                 P1001

XYZ                                 P1002

 

Thanks.

Nine Stars

Re: Numeric Sequence

Hi,

 

You'll probably need to read in the Customer Name data rows as a pre-step, get the unique customer names, generate the sequence from the unique list, then use tMap, to join the list of unique values and customer name back into the source:

 

1/ excel -> tuniq -> tJavaRow (generate sequence) -> hash or fileoutput

 

2/ excel -> tmap (join in hash or file from step one) -> output

 

Thanks

 

David

Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.
Six Stars

Re: Numeric Sequence

I have just provided sample data, there are multiple customers with same name. Some of the customers have repeated 18 times.

CustomerName

ABC

ABC

ABC

ABC

Nine Stars

Re: Numeric Sequence

Yup, and when you feed those through the tUniqRow, they will get resolved down to one row:

In: A,A,A,A,A,B,B,B,B,B,C,C,D,D,A,,A,B,B,C,D,E

 

Out: A,B,C,D,E

 

You then generate the the sequence for these unique names.

 

Unless I'm completely missing what you're after.

Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.
Six Stars

Re: Numeric Sequence

I need those multiple customers with same name listed in the output. I am not looking to get only unique records.

Thanks

Nine Stars

Re: Numeric Sequence

Yup, as per my original reply, step 1 - you get the unique customer names, generate the sequence on those, save into a hash or output file (lets call this unique customer sequences), step 2 - re-read the source data and join in the unique customer sequences.

Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog