INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Hi, I need help with this error

Hi, I need help with this error

(OP)
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

RE: Hi, I need help with this error

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

RE: Hi, I need help with this error

(OP)
Thank you!
I am now getting the message, "A string is required here.", over {TABLE.CARDNBR}.
Do you know what this needs?
Thanks again.

RE: Hi, I need help with this error

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

RE: Hi, I need help with this error

(OP)
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!

RE: Hi, I need help with this error

Create another formula

totext({TABLE.CARDNBR},0,"") place this alonside data and see what is returned

RE: Hi, I need help with this error

(OP)
The new formula is returning the remaining 7 numbers of the card.

Ex.
Card Results
123456004567891 4567891

??

RE: Hi, I need help with this error

(OP)
Card: 123456004567891

Results: 4567891

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close