Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have some data which looks like
How to I write a load script such that each sequential entry for car B, for example gets an incremental number so instead of above the data would look like
etc. Any ideas much appreciated
May be something like this?
Load Names,if(Previous(Names)=Names, Peek('Number')+1, 1) as Number;
LOAD * INLINE [
Names
A
A
A
A
A
B
B
B
C
D
D
E
E
E
E
F
];
try this,
Data:
LOAD *
FROM Table;
New:
noconcatenate
LOAD *,
if(rowno()=1 or CarNumber<>previous(CarNumber),1,peek('Number')+1) as Number
Resident Data
order by CarNumber;
drop table Data;
Maybe try with autonumber?
Load Autonumber (CarNumber,RecNo ()) as number, *;
LOAD * ;
TEMP:
Load *,
if(CarNumber <> previous(CarNumber), 1, peek(number)+1) as number;
Load * Inline [
CarNumber, RaceNumber, Red, speed, time
A, 110, 1, 3.06, 64.999
B, 58, 0, 85.38, 14.561
B, 125, 0, 86.56, 14.333
B, 460, 0, 83.92, 16.463
C, 197, 0, 111.9, 12.628
C, 263, 0, 112, 12.531
C, 311, 0, 111.86, 12.553
];
I think it should be
Autonumber(RowNo(), CarNumber) as number,
TEMP:
LOAD *,
AutoNumber(RowNo(), CarNumber) as number_Sun,
Autonumber (CarNumber,RecNo ()) as number1_Set;
LOAD * Inline [
CarNumber, RaceNumber, Red, speed, time
A, 110, 1, 3.06, 64.999
B, 58, 0, 85.38, 14.561
B, 125, 0, 86.56, 14.333
B, 460, 0, 83.92, 16.463
C, 197, 0, 111.9, 12.628
C, 263, 0, 112, 12.531
C, 311, 0, 111.86, 12.553
];
If your source table is not sorted by date, you might have to create the number field using a sorted resident load.
regards
Marco
Yes stalwar1. I interchanged the field and expression values.
thank you..
i think the below one also works..
Autonumber (RecNo (),CarNumber) as number1_Set;
it useful by using the recno rowno functions you get the data
Yes you are right, RecNo() will also work