Numeric Sequence

Four 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.

Seven 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

Don't forget to give Kudos when an answer is helpful or the solution.
Four 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

Seven 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

Don't forget to give Kudos when an answer is helpful or the solution.
Four 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

Seven 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

Don't forget to give Kudos when an answer is helpful or the solution.