Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
hello everyone,
i have function optimization problem, i want to count the distinct "%SessionID" with the help of my script.
i used this .....AutoNumber(RecNo(), %SessionId) as NewID ..// this is working perfectly ok...like its returning me the NewID field with values 1,2,3,4... but this autonumber function is slow i want to use some thing like this
if (peek( '%SessionID')= %SessionID , (%SessionID+1),1)....// its not working its returning me 1,1,1,1,1...in all fields with same %SessionID. but i need the outcome like 1,2,3,4....
Any help on this?
Regards,
Salman
 
					
				
		
 d_pranskus
		
			d_pranskus
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this example
t:
LOAD * INLINE [
%session
1
1
1
1
2
2
2
2
3
3
4
4
4
4
];
t1:
LOAD
%session,
IF(PEEK('%session') = %session, PEEK('newid') + 1, 1) AS newid
RESIDENT t;
DROP TABLE t;
And you must have your source table sorted by %session.
Darius
 
					
				
		
 d_pranskus
		
			d_pranskus
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Try this
if (peek( '%SessionID')= %SessionID , (peek('%SessionID')+1),1)
Darius
 
					
				
		
 CELAMBARASAN
		
			CELAMBARASAN
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Try with previous() or peek() like this
if (Previous( [%SessionID]) = [%SessionID] , (NewID+1),1) as NewID
if (peek( '%SessionID')= [%SessionID] , (NewID+1),1) as NewID
Celambarasan
 
					
				
		
thanks Darius, i have tried this but returning the same values in the column..1,1,1,1,1...
 
					
				
		
thanks Celambarasan, but getting the same result 1,1,1,1,1...
I have to use Autonumber for numbering like 1,2,3,4 .... for the same %SessionID ?
regards,
salman
 
					
				
		
 d_pranskus
		
			d_pranskus
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this example
t:
LOAD * INLINE [
%session
1
1
1
1
2
2
2
2
3
3
4
4
4
4
];
t1:
LOAD
%session,
IF(PEEK('%session') = %session, PEEK('newid') + 1, 1) AS newid
RESIDENT t;
DROP TABLE t;
And you must have your source table sorted by %session.
Darius
 
					
				
		
Perfect Darius,Thanks:)
