Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
customer | salesman | match | what is needed (run_sum) |
---|---|---|---|
A | S1 | 1 | 1 |
A | S1 | 1 | 2 |
A | S2 | 0 | 0 |
A | S3 | 1 | 1 |
A | S3 | 1 | 2 |
B | S1 | 0 | 0 |
B | S4 | 1 | 1 |
B | S4 | 1 | 2 |
B | S3 | 1 | 1 |
B | S3 | 1 | 2 |
if(Previous(customer&salesman)=customer&salesname,rangesum(peek(run_sum,-1),match),match) as run_sum
We're getting field not found <match>
This is a resident load from a table with customer,salesman, match
Seems to be working
Table:
LOAD * INLINE [
customer, salesman, match,
A, S1, 1
A, S1, 1
A, S2, 0
A, S3, 1
A, S3, 1
B, S1, 0
B, S4, 1
B, S4, 1
B, S3, 1
B, S3, 1
];
FinalTable:
LOAD *,
if(Previous(customer&salesman)=customer&salesman,rangesum(peek(run_sum,-1),match),match) as run_sum
Resident Table
Order By customer, salesman;
DROP Table Table;
Seems to be working
Table:
LOAD * INLINE [
customer, salesman, match,
A, S1, 1
A, S1, 1
A, S2, 0
A, S3, 1
A, S3, 1
B, S1, 0
B, S4, 1
B, S4, 1
B, S3, 1
B, S3, 1
];
FinalTable:
LOAD *,
if(Previous(customer&salesman)=customer&salesman,rangesum(peek(run_sum,-1),match),match) as run_sum
Resident Table
Order By customer, salesman;
DROP Table Table;
Oh merde - it was typo. Yes, it works now.