Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assign sequential number (001, 002, 003) for each unique name field?


Hi,

   I have a name field  COM_NM  .To each distinct COM_NM we need to assign sequential numbers --001,002,.......till the count of distinct COM_NM.

Can anybody give me exp:

Thanks

25 Replies
sunny_talwar

In the script, try this:

AutoNumber(COM_NM) as SEQ_NUM

Not applicable
Author

nope

petter
Partner - Champion III
Partner - Champion III

How about:

Test:

LOAD DISTINCT

  Num( AutoNumber( COM_NM , 'COM_NMs' ) , '000' ) AS COM_NMs

RESIDENT

  SomeSourceTable

ORDER BY

  COM_NM;

GabrielAraya
Employee
Employee

Or ...

Load Distinct

   Recno()  as Sequential,

    COM_NM

Resdent SomeTable;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What kind of reply is "nope"? Do you mean it gives an incorrect result, throws a script error, what?

-Rob

Not applicable
Author

‌hi petter ,

   Ur script is working but still has some problem .

i Will find it out and let u know . Thank u for script

Not applicable
Author

HI Petter,

   It is giving sequential numbers to all rows not to unique name.

Could any one tell for unique COM_NM

sunny_talwar

Petter's script should give you unique number for each distinct COM_NM. Would you mind sharing a sample???

Not applicable
Author

It gives me sequential numbers for all COM_NM ,but not unique ...(sharing is not possible) ....

IF  COM_NM  is njjhuihjhbhjbhj,,,,it is repeated  35 times  it gives me 001 to 035  number but not

001 for all..

Any help is appreciated