Re: Something does not add up

Peter Schubert SACO GmbH <[email protected]> Wed, 17 Mar 2021 19:43:02 +0100
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <[email protected]>
Tricky, but common typo

Use:

IF gr_charges.ship_charge IS NULL THEN

this should work

Am 17.03.21 um 19:20 schrieb James B. Byrne via Aubit4gl-discuss:
> 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';
> 

-- 
Mit freundlichen Grüßen

SACO Software and Consulting GmbH
Peter Schubert
Geschäftsführer

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
smime.p7s (application/pkcs7-signature, 3.9 KB) - not displayed