Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Problem : Show Orders History
I have Orders table with Fields of Order_Item_Num,Order_Num,Order_Date,Order_Item_Quantity,Order_Item_Price,Order_Item_Price_Total,
What I need to do is to show the last or previous info for each Order, in any date selected.
The Item can be twice a day or each day.
Means :
The last Order_Item_Quantity,Order_Item_Price,Order_Item_Price_Total
I know that I need to crate a history table connected to the Orders t dayable.
Please advice.
Jacov
Hello,
some hints for you :
to get previous order line :
left join (OrdersHistory) load
Order_Num,
Order_Item_Num,
if(Order_Num = previous(Order_Num), previous(Order_Item), null()) as Previous_Item
resident OrdersHistory
order by Order_Num, Order_Item_Num;
to get last order line :
left join (OrdersHistory) load
Order_Num,
LastValue(Order_Item_Num) as Last_Item
resident OrdersHistory
Order by Order_Num, Order_Item_Num
Group By Order_Num;
Hope it helps.
Yves,
It doesn't help me.
I need to get the info of the previous order, of the same item.
Since Order_Num = previous(Order_Num) will always be NO, it will always get NULL.
Jacov
Jacov,
try function FirstSortedValue - looks like your problem could be solved with it.
Oleg