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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Easiest way to add key to a table

I simply want to add a primary key to each of these distinct YearEvents:

yearevent.png

like so:

Key     YearEvent

0          2010 Comittee

1          2009 WTS

2          2012 Podium Speaker

...         ...

...         ...

101       2012 WTS

I know I can do this with a for loop but I feel like there is a much easier way to accomplish this. I feel like I'm brainfarting on this, either way, any help would be greatly appreciated.

1 Solution

Accepted Solutions
joshabbott
Creator III
Creator III


how about adding 'rowno() as id' as a column in your script?

View solution in original post

5 Replies
Not applicable
Author

did you check the autonumber()?

joshabbott
Creator III
Creator III


how about adding 'rowno() as id' as a column in your script?

ecolomer
Master II
Master II

Can you try with:

LOAD

     RecNo(),

    YearEvent

from FILE;

ecolomer
Master II
Master II

You can use also RecNo()

ecolomer
Master II
Master II

And RowNo()