Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.

Labels (2)
5 Replies
David_Beaty
Specialist
Specialist

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

Anonymous
Not applicable
Author

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

David_Beaty
Specialist
Specialist

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.

Anonymous
Not applicable
Author

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

Thanks

David_Beaty
Specialist
Specialist

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.