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!

Setting a formula to null 1

Status
Not open for further replies.

Baylor03

Programmer
Oct 3, 2003
9
US
I need help
Is there a way to set a formula to NULL? I'm writting a formula called "city to use" that checks the address type and if it is a home address I want to set it to the city, else I want to set it to NULL.
thanks for any help
 
Try something like:

if {table.addresstype} = "home address" then {table.address} else ""

I don't think that "" is technically null, but it is empty (length = 0), which might be all you're looking for.

-LB
 
Thanks.

thats what i had but the problem is that some values are already null, and i want to make the formula output null to match so i can do 1 simple suppression on the details (isNull {city to use}). Since NULL and "" are not the same thing this doesn't work.

Is there any way to so this? Any more help dealing with NULL will be greatly appreciated.
Thanks
 
As LB pointed out, you don't need null to accomplish this.

When you say some values are null, you might want to state the value of what, the addresstype field, or the address?

Try:

if isnull({table.addresstype}) or
{table.addresstype} = "home address" then
{table.address}
else
""

-k
 
thanks

thats how i have it and i can get it to work...my boss was just wondering about nulls and if there was a way to set something to null.

Thanks again for all your help
 
The way to force a NULL result in a CR formula is:

1) Write another formula called {@NULL} that contains any string.

2) Refer to this formula in your real formula:

if {table.addresstype} = "home address"
then {table.address}
else {@NULL}

3) Go back into the @NULL formula and delete the string, saving it empty.

This generates a null value as your else.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
thank you so much...this is exactly what i needed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top