Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

wunderch
New Contributor III

autonumber rows

Hi guys,

I have a table like this:

IDValue

1

50
1USA
1Mark
233
2

Germany

2Chris

Now I need a table like this:

IDValueKey
1501
1USA2
1Mark3
2331
2Germany2
2Chris

3

How can I do this in script??

Thanks for your answers!

Regards

Chris

1 Solution

Accepted Solutions

Re: autonumber rows

May be this

LOAD ID,

     Value,

     AutoNumber(RowNo(), ID) as Key

FROM ...;

7 Replies

Re: autonumber rows

May be this

LOAD ID,

     Value,

     AutoNumber(RowNo(), ID) as Key

FROM ...;

wunderch
New Contributor III

Re: autonumber rows

Thanks for your quick answer!

YoussefBelloum
Esteemed Contributor

Re: autonumber rows

Hi sunny,

autonumber is not supposed to create unique integer value for each distinct evaluated value ?

here on every line there is new rowno() number.

can you explain how it works please ?

Re: autonumber rows

I am not just using RowNo(), but AutoNumber on top of RowNo() which will restart counting based on different IDs. Does that make sense?

YoussefBelloum
Esteemed Contributor

Re: autonumber rows

Yes of course I read carefully what you suggested. I talk about rowno() only because rowno() is different on every line. and referering to the syntax, Autonumber created a unique integer for every value etc...

can't understand why it is restarting the counting using Rowno() and ID.. as long as every values evaluated on every line is unique.

Autonumber(1,1)

Autonumber(2,1)

Autonumber(3,1)

Autonumber(4,2)

Autonumber(5,2)

Autonumber(6,2)

Re: autonumber rows

Do you understand the use of the second parameter within the AutoNumber function, right? As long as the second parameter is the same in the AutoNumber it will create a continuous number, but once changed it restart the counting from 1. Autonumber will work like this....

Autonumber(1,1) = 1

Autonumber(2,1) = 2

Autonumber(3,1) = 3

Autonumber(4,2) = 1

Autonumber(5,2) = 2

Autonumber(6,2) = 3

YoussefBelloum
Esteemed Contributor

Re: autonumber rows

Thank you

No, I didn't know about it.. for this one I only read the help and i didn't notice the AutoID part (which is the second parameter you're talking about).

Community Browser