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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Empty text field ("") in formula not recognized

Status
Not open for further replies.

MRyerson

MIS
Jan 20, 2003
25
US
I am reporting off an ASCII comma-delimited text file. Strings are enclosed in double quotes. I am using a File DSN with the Microsoft Text Driver (ODBC). One field in the file contains a two-letter code designating a style of window, e.g., "DH" = Double-Hung, "SH" = Single-Hung, etc. I have a formula to 'translate' these codes, like this:
if Trim({CALLDMP_TXT.PROBLEMSTYLE}) = 'DH' then 'Double-Hung Window'
else
if Trim({CALLDMP_TXT.PROBLEMSTYLE}) = 'SH' then 'Single-Hung Window'
else
if Trim({CALLDMP_TXT.PROBLEMSTYLE}) = '' then 'No Style Specified'
else
'Invalid Style Code: ' & {CALLDMP_TXT.PROBLEMSTYLE}

The report is grouped by PROBLEMSTYLE and the formula object is placed in the group footer. Everything works, EXCEPT when the field in the file is empty (""). In this case, instead of printing "No Style Specified," as I would expect, it simply leaves the object blank.

I tried StrCmp, Len, and IsNull functions, all with the same results. I can find nothing like this in the Crystal Decisions KnowledgeBase.

Any ideas?

Thanks In Advance.
 
You must always test for nulls as the first test in your formula:

If Isnull({YourField} then "No Style Specified" else...

Try that and see if it works. Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
That worked. Thanks. I had tried putting the origial test at the beginning, but had not tried it with IsNull.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top