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!

Basic Formula Question

Status
Not open for further replies.

DataHog

Programmer
Sep 17, 2002
3
US
I need to search a field in a file for all records that have a "-" in the third position and print yes. If it doesn't search a different file and print out that field.

if {cust.PH_NMBR} [3] = "-" then "YES" else {rs.MODE}

My problem is that my else doesn't work.
 
have you checked {rs.mode} is actually retuning what it should? You may have your table relationships wrong. Just out of interest, try the formula the other way round, i.e. if {cust.PH_NMBR} [3] = "-" then {rs.MODE} else "YES" to check.

Or you could try:

if {cust.PH_NMBR} [3] <> &quot;-&quot; then {rs.MODE} else &quot;YES&quot;

Also, is there always at least 3 letters in PH-NMBR?
 
Yes, I did it the other way around and rs.mode printed out and else still didn't work.
 
Are {cust.PH_NMBR} and {rs.MODE} the same datatype?
 
Is {rs.MODE} a string datatype? The then and else parts of your formula must be the same datatype. If {rs.MODE} is a number, you can convert it to string as follows:

totext({rs.MODE},0) Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top