Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Evening,
I have a requirement to allocate a sequence number to my data from 1 to 7.
This must then repeat from 1 to 7 until the table has finished loading.
Table consists of a list of SKU's totaling 87000
The Idea is to use the sequence number to filter the data for easier analysis.
And then export each sequence number to an excel spreadsheet for import.
Sample Raw Data:
sku |
1000000 |
1000001 |
1000003 |
1000004 |
1000005 |
1000006 |
1000007 |
1000008 |
1000009 |
1000010 |
1000011 |
1000012 |
1000014 |
1000015 |
1000016 |
Desired Result:
sku | Seq |
1000000 | 1 |
1000001 | 2 |
1000003 | 3 |
1000004 | 4 |
1000005 | 5 |
1000006 | 6 |
1000007 | 7 |
1000008 | 1 |
1000009 | 2 |
1000010 | 3 |
1000011 | 4 |
1000012 | 5 |
1000014 | 6 |
1000015 | 7 |
1000016 | 1 |
Thank you in advance.
Hi @9917mark , here an example, please check if works for you :
Aux:
LOAD * INLINE [
sku
1000000
1000001
1000003
1000004
1000005
1000006
1000007
1000008
1000009
1000010
1000011
1000012
1000014
1000015
1000016
];
SKU:
Load
rowno() as Idf,
sku,
if(rowno() = 1 or peek(Seven) = 7, 1, peek(Seven) + 1) as Seven
Resident Aux;
drop table Aux,
OUTPUT :