Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear
I got the following sample data:
Visit, Location
1,L1
1,L2
1,L3
2,L4
2,L5
3,L6
what I want is to add a third column which will an autonumber that resets on each new value of Visit
i.e.
Visit, Location, Rank
1,L1,1
1,L2,2
1,L3,3
2,L4,1
2,L5,2
3,L6,1
LOAD
Visit,
Location,
autonumber(recno(), Visit) as Rank
FROM ...;
it doesn't give the desired result
and here is the result of your suggested solution:
Can't reproduce your results,
LOAD *,
AutoNumber(recno(), Visit) as Rank
INLINE [
Visit, Location
1,L1
1,L2
1,L3
2,L4
2,L5
3,L6
];
produces your requested outcome. Please post a sample application.
Try this...
T1:
LOAD * INLINE [
F1, F2
1, L1
1, L2
1, L3
2, L2
2, L4
3, L5
3, L7
];
T2:
Load *,
If(RecNo()=1,1,If(Previous(F1)=F1,Peek(Rank)+1,1)) as Rank
Resident T1
Order By F1;
Drop Table T1;
Better:
If(Previous(F1)=F1,Peek(Rank)+1,1) as Rank,