Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I had some datase like below
load * inline
[networkid, user, timestamp
n1,u1,1
n1,u2,2
n1,u3,3
n2,u1,2
n2,u2,3
n2,u3,1
n3,u1,3
n3,u2,2
n3,u3,1
n2,u1,3
n1,u1,3];
now i need to get only first record of user based on timestamp
something as below.
users timestamp(max) network
u1 3 n3
u2 3 n2
u3 3 n1
I am able to get this in front end(sheet).but i need to get this in script part only
please help me how to acheive this
Table1:
load * inline
[networkid, user, timestamp
n1,u1,1
n1,u2,2
n1,u3,3
n2,u1,2
n2,u2,3
n2,u3,1
n3,u1,3
n3,u2,2
n3,u3,1
n2,u1,3
n1,u1,3];
Table2:
load user, max(timestamp) as TimestampMax, firstsortedvalue(networkid, -timestamp) as Network
resident Table1
group by user;
Hi,
have a look at the firstsortedvalue command.
After you load the inline, try with:
Load user,
firstsortedvalue(network, timestamp) as FirstTimeStamp resident InlineTableName,
group by user;
Regards.
Table1:
load * inline
[networkid, user, timestamp
n1,u1,1
n1,u2,2
n1,u3,3
n2,u1,2
n2,u2,3
n2,u3,1
n3,u1,3
n3,u2,2
n3,u3,1
n2,u1,3
n1,u1,3];
Table2:
load user, max(timestamp) as TimestampMax, firstsortedvalue(networkid, -timestamp) as Network
resident Table1
group by user;
HI
Try like this
Load user,
firstsortedvalue(network, -timestamp) as FirstTimeStamp resident InlineTableName,
group by user;
got it worked wasaneer. thank u so much