有没有办法在 4gl 查询中按表中的字段对记录进行分组?
My code.
define variable v-invoice as inte no-undo.
define variable v-sell-price as decimal no-undo.
define variable v-cost-price as decimal no-undo.
define variable iinv as integer no-undo.
For each Order no-lock :
v-invoice = Order.tblinvoice.
v-sell-price = Order.sell-price.
v-cost-price = Order.cost-price.
iinv = iinv + Order.sell-price.
display Order.invoice Order.sell-price.
end.
谢谢
是的,当然可以,非常基本:
DEFINE VARIABLE v-sell-price AS INTEGER NO-UNDO.
DEFINE VARIABLE v-cost-price AS INTEGER NO-UNDO.
FOR EACH order BREAK BY order.invoice:
/* Sum the prices */
ASSIGN
v-sell-price = v-sell-price + Order.sell-price.
v-cost-price = v-cost-price + Order.cost-price.
/* On the last order matching this order display and reset sums */
IF LAST-OF(order.invoice) THEN DO:
DISPLAY Order.invoice v-sell-price v-cost-price.
ASSIGN
v-sell-price = 0
v-cost-price = 0.
END.
END.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)