Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arithmetic with possible Null values - Help!

Status
Not open for further replies.

tex4kkp

Programmer
Feb 28, 2003
8
US
I have 2 fields in my CR8 report - lets call them Field 1
and field2
Field 1 and 2 could be a number, or could be Null.
however, I want to subtract Field 2 from field 1 and display as another field, say fiedl 3.
is there a way to do it WITHOUT making 2 other formula fields that checks if Field1 and field2 are null and assigns them a zero value?
I want to accomplish all this with 1 more additioanl field (ie, field 3).
thanks!
 
If you don't care about nulls being in the report, select File->Report Options->Convert Null Value to Default.

Otherwise create a formula, as in:

switch(isnull({field1}),0,
not(isnull({field1})),{field1})
-
switch(isnull({field2}),0,
not(isnull({field2})),{field2})

And there are other ways...

-k
 
If isnull({field1}) and isnull({field2}) then 0 else
If isnull({field1}) and Not(isnull({field2})) then {field2} else
If isnull({field2}) and Not(isnull({field1})) then {field1} else
{field1}-{field2}


Reebo
Scotland (Sunny with a Smile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top