Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
peschu123
Partner - Creator III
Partner - Creator III

Problem with picking the previous process in script

Hi,

I want to calculate the days between operations in an order.

The table contains multiple Orders with each multiple operations.

So I use in the first step:

[Start Operation] - peek([End Operation],-1)) AS [DaysWaiting]

Until this point it works pretty well. But the first operation takes the End Date from the last operation of the previous order.

To fix this I thought it could be done with:

    IF(%ORDER = previous(%ORDER),[Start Operation] - peek([End Operation],-1), null()) AS [DaysWaiting]

But it totally messes up the dates :-/. The table is sorted by Order, Operation ...

Has anybody a clue what I'm doing wrong?

Regards,

Peter

1 Solution

Accepted Solutions
peschu123
Partner - Creator III
Partner - Creator III
Author

I had to do a resident load of the same table with "Order By ..." and now it works...

View solution in original post

1 Reply
peschu123
Partner - Creator III
Partner - Creator III
Author

I had to do a resident load of the same table with "Order By ..." and now it works...