String Field Comparisons

10 pts.
Tags:
Crystal Reports
String manipulation
I am attempting to create a formula in Crystal Reports That will compare two string fields and print out an ID number. It seems as though it should be quite simple. Please help.

Software/Hardware used:
SQL Server 2008
ASKED: January 15, 2010  7:50 PM
UPDATED: January 19, 2010  7:21 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you have a defined list of values for your string field, a simple ‘if..then..else’ should suffice i.e

<pre>
if {StringField} = “XXX” then “Code1″ else
if {StringField} = “YYY” then “Code2″ else
if {StringField} = “ZZZ” then “Code3″ else…

else “ERROR : No Match Found)
</pre>

However if this used in multiple reports and the values change, maintaince will become difficult

if you have a table of the values & serial codes in a databse somthing like this should work

<pre>if {StringField} in {LookupField} then {SerialCodeField} else “ERROR : No Match Found”</pre>

This way if you change or add somthing, no maintaince of the report(s) required

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following