Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jduluc12
Creator
Creator

Load script to populate unique row numbers

Hi,

My data set looks like this.

IDCUSTCITY
ID-1CCTY-1
ID-1C-1CTY-1
ID-2C-2CTY-2
ID-3C-3CTY-3
ID-4C-3CTY-4

 

I need to write a load script that adds a row# column to this table in the following manner.

IDCUSTCITYROW#
ID-1CCTY-11
ID-1C-1CTY-12
ID-2C-2CTY-21
ID-2C-3CTY-32
ID-4C-3CTY-41

 

The ROW# grows sequentially for the same ID and then restarts for each new ID as shown in the table above.

Thanks,

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try using second parameter in autonumber() like:

Autonumber(RowNo(), ID) as Increment

View solution in original post

4 Replies
jochem_zw
Employee
Employee

Try Autonumber(ID)
jduluc12
Creator
Creator
Author

thanks for the answer but this may not work for me.

it autogenerates the ID in a sequence but  I need to restart the number for a new ID the way I have shown in the second table.

 

tresesco
MVP
MVP

Try using second parameter in autonumber() like:

Autonumber(RowNo(), ID) as Increment

Brett_Bleess
Former Employee
Former Employee

Just adding Help link to AutoNumber():

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Count...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.