Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Restart autonumber count every....X

Howdy,

I'm building a dashboard to analyze the Sessions_Servername log file.

I want to restart my autonumber counter every Day for each user...So each user will have X # of sessions for each day, then it will restart the next day.

Sample output:

User,       Date,       Autonumber(???)

David,    1/1/2014,  1

David     1/1/2014,  2

David     1/1/2014,  3

David     1/2/2014,  1

David     1/2/2014,  2

David     1/2/2014,  3

David     1/2/2014,  4



Much thanks,


-David

1 Solution

Accepted Solutions
maxgro
MVP
MVP

RESULT

1.png


SCRIPT

a:

load User, Date inline [

User,      Date,      Autonumber

David,    1/1/2014,  1

David ,    1/1/2014,  2

David ,    1/1/2014,  3

David ,    1/2/2014,  1

David ,    1/2/2014,  2

David ,    1/2/2014,  3

David ,    1/2/2014,  4

Simon,    1/1/2014,  1

Simon ,    1/1/2014,  2

Simon ,    1/1/2014,  3

Simon ,    1/2/2014,  1

Simon ,    1/2/2014,  2

Simon ,    1/2/2014,  3

Simon ,    1/2/2014,  4

];

b:

NoConcatenate

load *,

if(User<>peek(User) or Date<>Peek(Date), 1, peek(id)+1) as id

Resident a

order by User, Date;

DROP Table a;

View solution in original post

2 Replies
maxgro
MVP
MVP

RESULT

1.png


SCRIPT

a:

load User, Date inline [

User,      Date,      Autonumber

David,    1/1/2014,  1

David ,    1/1/2014,  2

David ,    1/1/2014,  3

David ,    1/2/2014,  1

David ,    1/2/2014,  2

David ,    1/2/2014,  3

David ,    1/2/2014,  4

Simon,    1/1/2014,  1

Simon ,    1/1/2014,  2

Simon ,    1/1/2014,  3

Simon ,    1/2/2014,  1

Simon ,    1/2/2014,  2

Simon ,    1/2/2014,  3

Simon ,    1/2/2014,  4

];

b:

NoConcatenate

load *,

if(User<>peek(User) or Date<>Peek(Date), 1, peek(id)+1) as id

Resident a

order by User, Date;

DROP Table a;

anbu1984
Master III
Master III

Load *,AutoNumber(RecNo(),Date) Inline [

User,Date

David,1/1/2014

David,1/1/2014

David,1/1/2014

David,1/2/2014

David,1/2/2014

David,1/2/2014

David,1/2/2014 ];