Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
markp201
Creator III
Creator III

Peek function - field not found...

customersalesmanmatch

what is needed

(run_sum)

AS111
AS112
AS200
AS311
AS312
BS100
BS411
BS412
BS311
BS312

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

1 Solution

Accepted Solutions
sunny_talwar

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;

View solution in original post

2 Replies
sunny_talwar

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;

markp201
Creator III
Creator III
Author

Oh merde - it was typo.  Yes, it works now.