Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
veronicahernand
Partner - Contributor III
Partner - Contributor III

peek and erase previous value in script

Hi guys, 

I need your help.

I have a client that has proforma invoices and final invoices ("factura"). So, I have concatenated them in the same table.

The most important fields are:

key=order no&order pos no&delivery no&delivery pos no&client&article

document date

document hour

sales

The proforma invoice and the final invoice share a common key. The proforma invoice is created before the final invoice. And they have the same sales amount.

If we have the final invoice done I need to get only the value of it so the value of sales doesn't get duplicated and it doesn't look they have that value still to bill.

I use the following code:

load 

rowno() as rowno,

if(peek(Key,-1)=Key ,0, sales) as sales

resident Facturas_temp
order by Key, document date, document hour desc;

But the result I get is this, it looks like the order it's not working properly 

 
 
 

Thanks!!!!

 
 
 

 

Labels (4)
1 Reply
veronicahernand
Partner - Contributor III
Partner - Contributor III
Author

Captura.JPG