A not so elegant solution is to write a stored procedure to do the dirty
work. Using cval('zero') you can save the value of the set zero command, set
zero off and do your calculation, which the stored procedure would return
the result. After you are finished you can set zero back to the state it was
in.

 

This assumes your update statement doesn't depend on set zero on.

 

Ken

 

From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence
Lustig
Sent: Thursday, June 23, 2011 5:05 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Issue with IFNULL and SET ZERO.

 

I have a table with two currency columns LOWPRICE and REGULARPRICE.
REGULARPRICE always has a value in it.  LOWPRICE sometimes has a value in
it.

 

I need to derive a third value (preferably in a computed column) according
the following rule:

 

If LOWPRICE is NULL, use REGULARRICE.

IF LOWPRICE is NOT NULL, use the lower of LOWPRICE and REGULARPRICE, even if
LOWPRICE is $0.00.

 

I can do this with the expression (IFNULL(LOWPRICE, REGULARPRICE,
LMIN(LOWPRICE, REGULARPRICE)).  That works fine -- but only if SET ZERO OFF
is applied.  If SET ZERO ON is applied, R:Base loses the ability to
distinguish between the values $0.00 and NULL in LOWPRICE.

 

I'm looking for a trick that will be able to distinguish NULL and $0.00 with
ZERO set ON.

 

Anyone have any ideas?

--

Larry

Reply via email to