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!

parsing a numeric field?

Status
Not open for further replies.

pwobus

Programmer
Mar 22, 2001
3
US
I am new to Crystal Reports and have what you will no doubt think is a simple problem.

I am attempting (with some difficulty) to parse a numeric field and extract from it a value. The value I want to extract is in the second column of the ID field and has a value of 1 or 2. For example, here is the ID variable and the values that I need to extract:

ID field I need to TeachType
extract
2123 1 Study Teacher
3145 1 Study Teacher
2156 1 Study Teacher
4276 2 Comparison Teacher
4245 2 Comparison Teacher
2234 2 Comparison Teacher


The following formula I am using is producing an error:

WhileReadingRecords
NumberVar TeachType;
TeachType := ToText{tblTeacher.teacherID};
If LooksLike ({TeachType},"?1??") Then
"Study Teacher"
Else
"Comparison Teacher";

Can someone please help?
 
TeachType is not a numeric variable.

Note: You can achieve the same thing with a
Formula instead of using variables.

hth,
- Ido
 
Assuming that {ID} is really a string field you could use:

If {ID} [2] = '1'
Then "Study Teacher"
Else "Comparison Teacher"


If it is truly a numeric you would need to use:

If Totext({ID},0,'') [2] = '1'
Then "Study Teacher"
Else "Comparison Teacher" Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top