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!

string/number formula

Status
Not open for further replies.

cnice9

IS-IT--Management
Apr 29, 2003
20
0
0
US
I have a report card that lists the grades for a student in a string field. This field has both numbers ranging from 0 to 110 and alpha characters in it. My problem is that if the student grade is less then 70 I need to show an F other wise I show the grade be it alpha or numeric. I am using the following simple formula in CR 9:
if {Table.GradeMP1} <= &quot;69&quot; then &quot;F&quot; else {Table.GradeMP1}

The problem occurs when the grade is 100 or greater it is also recieving the F since it is a string and sees 100 as 10. I have tried to use the tonumber function but that causes the rest of my formula to expect a number.
If anyone can help it would be greatly appreciated since I have a customer waiting to print. Thanks in advance

C.Nice
RealTime Information Technology Inc.
 
This works, but not knowing what other possible date you could have, I can't know for sure if it will work in all cases. Can you post more sample date, specifically ones that contain alpha charcaters. Is there any kind of pattern within the data that we could extract the numeric portion adn then use yor formula?

Code:
if Length({Table.GradeMP1}) > 2 then
    {Table.GradeMP1}
else if {Table.GradeMP1} IN [&quot;0&quot; to &quot;69&quot;] then 
    &quot;F&quot; 
else
    {Table.GradeMP1}

~Brian
 
Thanks Brian, you suggestion worked perfectly and is very much appreciated. I have to say that I found your approach interesting and not in a direction I was thinking. Thanks again.

Chris

C.Nice
RealTime Information Technology Inc.
 
It could be streamlined a bit, nmy first post was a little hasty.
Code:
if Length({Table.GradeMP1}) <= 2 AND
   {Table.GradeMP1} IN [&quot;0&quot; to &quot;69&quot;] then 
    &quot;F&quot; 
else
    {Table.GradeMP1}

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top