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

Hi, I need help with this error

Status
Not open for further replies.

NLR12

MIS
Dec 22, 2011
6
0
0
US
Hi,

I need help with this error in Crystal Reports.
I'm using the following formula in Field Explorer:

IF {TABLE.CARDNBR} = 123456* then "{TABLE.OWNERNAME}" else " "

I get the Crystal Reports error "A number,currency amount, boolean, date, time, etc. is expected here." over the "then".
I want to display the owner of the card only when the card number begins with 123456 otherwise it should be blank.
I am fairly new using Crystal; any help is appreciated.

NLR12
 
You must enclose strings in either double or single quotes, no need to put field name in quotes.

Wild card must be used with LIKE

IF {TABLE.CARDNBR} like "123456*" then {TABLE.OWNERNAME} else " "

Ian
 
Thank you!
I am now getting the message, "A string is required here.", over {TABLE.CARDNBR}.
Do you know what this needs?
Thanks again.
 
Because that is a number, sorry I assumed it was a string. You cannot use a wild card with a number.

you can convert to text first.

IF totext({TABLE.CARDNBR},0,"") like "123456*" then {TABLE.OWNERNAME} else " "

The extra arguments in totext remove decimal places and thousand separators.

Ian
 
It seems there are no longer any errors; however, it does not give me the results I'm looking for.
Example of what I need:
Card Owner Name
12345600000 Joe's Deli
45612300000

Results of current formula:
Card Owner Name
12345600000
45612300000

Do you know why it is not supplying the correct info?

Thanks!

 
Create another formula

totext({TABLE.CARDNBR},0,"") place this alonside data and see what is returned
 
The new formula is returning the remaining 7 numbers of the card.

Ex.
Card Results
123456004567891 4567891

??
 
Card: 123456004567891

Results: 4567891
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top