Hi,
I am "struggling" quit a bit with adm So's. I've made a little simple program which does next (connected to sports2000 db):
- An oder sdo
- An orderLIne sdo
- An order sbd
- An orderline sdb and sdv
So, i get a list of orders and related orderlines, i can create/update/delete new ordelines, total of orderlines is
recalculated in the endTransVal in the orderline sdo
as next: (the order browse always visible, the orderlines are
shown in a smartfolder, page 1: browse of orderlines, page 2:
update of a particular orderline in a viewer)
DEF VAR dTotal AS DEC NO-UNDO.
FIND FIRST RowObjUpd.
FIND order WHERE order.ordernum EQ RowObjUpd.OrderNum EXCLUSIVE-LOCK NO-ERROR.
FOR EACH orderline WHERE orderline.ordernum EQ order.ordernum NO-LOCK:
dTotal = dTotal + orderline.extendedPrice.
END.
order.orderTotal = dTotal.
RELEASE order.
Ordertotal is a field or order tabel, the ordertotal is taken
in the order sdb, but when i click on the smartpanel update
after updating the orderlines, the total for the order (order.ordertotal) isn't refreshed in the order sdb.
When i create a button, and i put next code into it
(to refresh the order sdo query, then info is recalculated):
DYNAMIC-FUNCTION('openQuery':U IN h_dorder).
But this should be done automatically after updating the
related orderlines, namely after the endTransVal code
has been executed
endTransVal in orderline sdo :
/* begin of endTransVal */
DEF VAR dTotal AS DEC NO-UNDO.
FIND FIRST RowObjUpd.
FIND order WHERE order.ordernum EQ RowObjUpd.OrderNum EXCLUSIVE-LOCK NO-ERROR.
FOR EACH orderline WHERE orderline.ordernum EQ order.ordernum NO-LOCK:
dTotal = dTotal + orderline.extendedPrice.
END.
order.orderTotal = dTotal.
RELEASE order.
/* end of endTransVal */
Smart links for this program:
h_dorder -> data -> h_border
h_dorder -> data -> h_dorderline (for. field : ordernum)
h_dorderline -> data -> h_borderline
h_dorderline -> data -> h_vorderline
h_dyntoolbar -> Navig -> h_dorderline
h_dyntoolbar -> tableio -> h_vorderline
h_pnavico -> navi -> h_dorder
h_vorderline -> update h_dorderline
Thanx for any response,
Emmanuel.
I am "struggling" quit a bit with adm So's. I've made a little simple program which does next (connected to sports2000 db):
- An oder sdo
- An orderLIne sdo
- An order sbd
- An orderline sdb and sdv
So, i get a list of orders and related orderlines, i can create/update/delete new ordelines, total of orderlines is
recalculated in the endTransVal in the orderline sdo
as next: (the order browse always visible, the orderlines are
shown in a smartfolder, page 1: browse of orderlines, page 2:
update of a particular orderline in a viewer)
DEF VAR dTotal AS DEC NO-UNDO.
FIND FIRST RowObjUpd.
FIND order WHERE order.ordernum EQ RowObjUpd.OrderNum EXCLUSIVE-LOCK NO-ERROR.
FOR EACH orderline WHERE orderline.ordernum EQ order.ordernum NO-LOCK:
dTotal = dTotal + orderline.extendedPrice.
END.
order.orderTotal = dTotal.
RELEASE order.
Ordertotal is a field or order tabel, the ordertotal is taken
in the order sdb, but when i click on the smartpanel update
after updating the orderlines, the total for the order (order.ordertotal) isn't refreshed in the order sdb.
When i create a button, and i put next code into it
(to refresh the order sdo query, then info is recalculated):
DYNAMIC-FUNCTION('openQuery':U IN h_dorder).
But this should be done automatically after updating the
related orderlines, namely after the endTransVal code
has been executed
endTransVal in orderline sdo :
/* begin of endTransVal */
DEF VAR dTotal AS DEC NO-UNDO.
FIND FIRST RowObjUpd.
FIND order WHERE order.ordernum EQ RowObjUpd.OrderNum EXCLUSIVE-LOCK NO-ERROR.
FOR EACH orderline WHERE orderline.ordernum EQ order.ordernum NO-LOCK:
dTotal = dTotal + orderline.extendedPrice.
END.
order.orderTotal = dTotal.
RELEASE order.
/* end of endTransVal */
Smart links for this program:
h_dorder -> data -> h_border
h_dorder -> data -> h_dorderline (for. field : ordernum)
h_dorderline -> data -> h_borderline
h_dorderline -> data -> h_vorderline
h_dyntoolbar -> Navig -> h_dorderline
h_dyntoolbar -> tableio -> h_vorderline
h_pnavico -> navi -> h_dorder
h_vorderline -> update h_dorderline
Thanx for any response,
Emmanuel.