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!

IF ISNULL formula

Status
Not open for further replies.

jruell

IS-IT--Management
May 2, 2003
1
US
I am kind of new to Crystal Reports and I am trying to finish a report and I am having a problem with the ISNULL command.

I have a table that has a field this is populated with either "T", "F" or no value at all. I tried to write a formula that would take the no value and enter in "F" I used IF ISNULL ({arord.postedgl}) then 'F' else 'T'

This formula does not produce the result I am looking for. It returns the result of "F" for everthing.

Any help would be appreciated.

thanks
Jim
 
I have had mixed results with isnull() particularly with old btrieve databases. Try this:

If isnull({YourField}) or if length(trim({YourField}))=0 then "F" else "T"

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
I have a table that has a field this is populated with either "T", "F" or no value at all. I tried to write a formula that would take the no value and enter in "F" I used IF ISNULL ({arord.postedgl}) then 'F' else 'T'

******************************

well this formula would convert "F" to "T" if it worked which I don't think is a desired result for you.

I am not certain if you posted the whole formula (which you should always do) or just the "important snippet" (which often doesn't tell the whole story)

My formula for this would be

@resolve

WhilePrintingRecords;

if not isNull({arord.postedgl}) then
{arord.postedgl}
else
"F";

This doesn't disturb legite values of your field. Sometimes Blanks are inserted instead of NULLS...if you want to convert those also to "F" then make the formula

@resolve

WhilePrintingRecords;

if not isNull({arord.postedgl}) and
length(trim({arord.postedgl})) <> 0 then
{arord.postedgl}
else
&quot;F&quot;;

I prefer testing - Not IsNull - rather than -IsNull





Jim Broadbent
 
I have a table that has a field this is populated with either &quot;T&quot;, &quot;F&quot; or no value at all. I tried to write a formula that would take the no value and enter in &quot;F&quot; I used IF ISNULL ({arord.postedgl}) then 'F' else 'T'

******************************

well this formula would convert &quot;F&quot; to &quot;T&quot; if it worked which I don't think is a desired result for you.

I am not certain if you posted the whole formula (which you should always do) or just the &quot;important snippet&quot; (which often doesn't tell the whole story)

My formula for this would be

@resolve

WhilePrintingRecords;

if not isNull({arord.postedgl}) then
{arord.postedgl}
else
&quot;F&quot;;

This doesn't disturb legite values of your field. Sometimes Blanks are inserted instead of NULLS...if you want to convert those also to &quot;F&quot; then make the formula

@resolve

WhilePrintingRecords;

if not isNull({arord.postedgl}) or
length(trim({arord.postedgl})) <> 0 then
{arord.postedgl}
else
&quot;F&quot;;

I prefer testing - Not IsNull - rather than -IsNull





Jim Broadbent
 
sorry about the double post...the first post has an error in the last formula

Jim Broadbent
 
To make sure that your blanks are truly nulls try the formula:

IsNull ({field})

All by itself. See if the blanks come up TRUE. If not, they are not NULL values.

Also, browse to confirm the data type of this field, which will make a difference when used in formulas.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Here you go (I hope):

If IsNull({arord.postedgl}) or {arord.postedgl} = &quot;&quot;
Then &quot;F&quot;
Else ({arord.postedgl})
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top