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!

Formula to select records if the field contains a "Y"

Status
Not open for further replies.

lindagoodwin

IS-IT--Management
Nov 16, 2007
22
US
I am using Crystal Reports 10.0

I have a field that contains the Patient Insurance ID.

INSURANCE.PATIENT_HEALTHCARE_COVERAGE_ID

The field should look similar to these:

897451234D5
145891177Y3
6549812677Y

I only need to pull the records with a "Y" in the last two digits. I have no idea how to do this. Any help you can give would be greatly appreciated.

Thanks
 
Try something like
Code:
if Right({Yourfield},1) = "Y"
or Mid({Yourfield},10, 1) = "Y"

If the field lenght is variable, you could use Left(Right({Yourfield},2), 1) = "Y" for the second test.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Or maybe:

right({your.field},2) like '*Y*'

Or if the text is not guaranteed to be uppercase then:

ucase(right({your.field},2)) like '*Y*'


'J

CR8.5 / CRXI - Discovering the impossible
 
The first formula suggested worked perfectly. Thank you very much. It makes my job much easier today!!!
 
Instr({YourField},"Y")>0

The above will tell you if the string contains a Y anywhere within the string.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top