Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
sunilkumarqv
Valued Contributor II

Autogenarate Numbers

     Hi need to auto generate ids based on the numbers like

Examples

slno, num, Autogerate

1,        1 ,       1

2,        1,        2

3,        23,     1

4,        23,     2

5,        23,     3

6,        23,     4

7,        12,     1

8,        12,     2

9,        15,     1

If u noticed autogerate column

for first two common numbers 1,2 and next 3 to 6  slno should repeated numbers 1,2... similarly so on , im wondering ill get any help

1 Solution

Accepted Solutions
MVP
MVP

Re: Autogenarate Numbers

Easier way should be like:

Load

          slno,

          num,

          Autonumber(slno,num) as AutoGenSeq

...

3 Replies
ali_hijazi
Honored Contributor

Re: Autogenarate Numbers

temp:

load slno, num

resident your table order by num asc;

load * , if (rowNo() = 1 or num<> previous(num),1,peek(Autognerate) + 1) as AutoGenerate

resident temp;

drop table temp;

Re: Autogenarate Numbers

Hi,

Try this ways

LOAD

slno, num, Autogerate,

if(num = Previous(num),Peek(Num)+1,1 ) as AutogerateNew;

LOAD * INLINE [

    slno, num, Autogerate

    1, 1, 1

    2, 1, 2

    3, 23, 1

    4, 23, 2

    5, 23, 3

    6, 23, 4

    7, 12, 1

    8, 12, 2

    9, 15, 1

];

And you get this table fields

autogennum.png

Regards

Anand

MVP
MVP

Re: Autogenarate Numbers

Easier way should be like:

Load

          slno,

          num,

          Autonumber(slno,num) as AutoGenSeq

...

Community Browser