Something does not add up
"James B. Byrne via Aubit4gl-discuss" <[email protected]> Wed, 17 Mar 2021 14:20:50 -0400
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <[email protected]> |
Can anyone explain to me:
1. why gr_ship.ship_charge does not display as 0.00 in the first DISPLAY line?
2. why gr_charges.order_total appears to disappear?
CODE
IF gr_charges.ship_charge = NULL
THEN
LET gr_charges.ship_charge = 0.00
END IF
LET gr_ship.ship_charge = gr_charges.ship_charge
DISPLAY "AOT: ", gr_charges.order_total, " SC: ", gr_ship.ship_charge
SLEEP 5
LET gr_charges.order_total = gr_charges.order_total + gr_charges.ship_charge
DISPLAY "BOT: ", gr_charges.order_total, " SC: ", gr_ship.ship_charge
SLEEP 5
RESULTS:
AOT: 268.1250 SC:
BOT: SC:
These elements are defined thus:
DEFINE gr_charges
RECORD
tax_rate DECIMAL(5,3),
ship_charge LIKE orders.ship_charge,
sales_tax DECIMAL(16,4),
order_total DECIMAL(16,4)
END RECORD
DEFINE gr_ship
RECORD
ship_date LIKE orders.ship_date,
ship_instruct LIKE orders.ship_instruct,
ship_weight LIKE orders.ship_weight,
ship_charge LIKE orders.ship_charge
END RECORD
And orders.ship_charge is defined like this in PostgreSQL:
ALTER TABLE public.orders
ADD COLUMN ship_charge numeric(16,4);
COMMENT ON COLUMN public.orders.ship_charge
IS 'Shipping charge';
--
*** e-Mail is NOT a SECURE channel ***
Do NOT transmit sensitive data via e-Mail
Unencrypted messages have no legal claim to privacy
Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne mailto:[email protected]
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3