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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert a Text field to be used in a numeric formula 2

Status
Not open for further replies.

agreen10

IS-IT--Management
Oct 20, 2005
70
US
What is the most efficient way to convert a test field to be used in a calculation. I used:

tonumber ({Field1}) and I keep getting an error in the evaulation formula that says it is non-numeric.
 
Please supply some samples of the field that show the possible variations. If the number you want is always leading, then you could use:

val({table.string})

If the first character is not a number, this formula will return a zero and would not pick up subsequent numbers.

-LB

 
I have two fields that hold scores. I need to use those scores in calculations, however, they are designed as strings. I tried to use a formula to convert them using "tonumber" but when I actually use them in a formula, I keep getting "the string is non-numeric". eg

{grade} - {score_1} where score_1 is the formula "tonumber({score})".

I hope this helps clarify what I am doing.
 
What about testing the string field for numeric first:
if isnumeric(trim(({score}) then
tonumber({score})
else
0

Daniela
 
As Daniela's formula demonstrates, you DON'T have numerics in all of them.

You can demonstrate the non-numerics by putting the following in the Report->Selection Formulas->Record:

not(isnumeric({score}))

Then place the {score} field in the details and you'll discover the offending fields.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top