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

Formula Fields

Status
Not open for further replies.

lsaltzman

Programmer
Aug 16, 2000
5
US
I have a formula field that is going to pull in a value from a string field in a database and if the field is then put in a string indicating that the field was empty.<br><br>In the past I have done syntax as follows:<br>if {db.fldIPMgrFirst} &lt;&gt;&quot;&lt;none&gt;&quot; then<br>&nbsp;{db.fldIPMgrLast} +&quot;,&nbsp;&nbsp;&quot; {db.fldIPMgrFirst}}<br><br>else<br>&nbsp;&nbsp;&nbsp;&nbsp;&quot;A name was not selected&quot;<br><br>In this case I need to handle a situation where I am looking for an empty field and deciding what to do.<br><br>I have tried to the following which does not work.<br><br>if {db.FieldName} = &quot;&quot; then<br>&nbsp;&nbsp;&nbsp;&quot;A name was selected&quot;<br>else<br>&nbsp;&nbsp;&nbsp;&nbsp;{db.Fieldname}<br><br>I have tried to use len() to have an if else statement based on wheither the incoming field was less then 1 and failed to figure that out<br>&nbsp;&nbsp;<br>Thanks for the help in advance.
 
Hmmm ... &quot;does not work&quot;<br>if {db.FieldName} = &quot;&quot; then<br>&nbsp;&nbsp;&nbsp;&quot;A name was selected&quot;<br>else<br>&nbsp;&nbsp;&nbsp;&nbsp;{db.Fieldname}<br>means either it delivered the incorrect result, no result, or generated an error.&nbsp;&nbsp;<br>Can {db.FieldName} contain null values, and if so, are they equvalent in this particular field to empty strings?<br>
 
I should be more specific. Many of the records in the database have this particular field as an empty string.<br><br>I could find no way to handle a null field or empty field with syntax in the formula.&nbsp;&nbsp;When I try to save the example I gave I get an error back from Crystal Reports.
 
Have you tried the isnull function?
If isnull({db.FieldName}) = True then ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top