Testing for numeric input

Peter Bateman shediac92@hotmail.com
Wed, 19 May 2004 12:44:25 -0300


Martyn:

  The following should handle a numeric entry
  MATCHPATTERN ( FIELDTEXT,'(+|-)<(##*(.#*)<)|(.##*)' )

  The code after the  last OR bar handles numbers that are less than 1 in 
absolute
  value.

Regards,
Peter
>From: "Thomson, Martyn EDUC:EX" <Martyn.Thomson@gems1.gov.bc.ca>
>To: "POWERHOUSE NEW (E-mail)" <powerh-l@sowder.com>
>Subject: RE: Testing for numeric input
>Date: Tue, 18 May 2004 14:44:17 -0700
>
>Thanks for the suggestions.
>I should have mentioned that depending on the value entered in a previous
>field, the user can enter a letter in the range A to H, or a numeric value!
>That's why I wanted to be able to test if the value entered was numeric
>after the event.
>I see that I'm overloading this field and that's not really going to fly, 
>so
>now I'm experimenting with a temporary that occurs with the table,
>positioned just before the numeric field and will control which field is
>ACCEPTed from a silent field before the two. Then I'll have to manually
>assign the temporary to the table field, control it's display on prescroll,
>postscroll, etc.
>
>
>
>
>-----Original Message-----
>From: Pickering, John (NORBORD) [mailto:PICKERIJ@norbord.com]
>Sent: May 18, 2004 2:27 PM
>To: Thomson, Martyn EDUC:EX; POWERHOUSE NEW (E-mail)
>Subject: RE: Testing for numeric input
>
>
>How about letting PowerHouse do the job for you. Even though the field is
>defined as character in the dictionary or screen you can put NUMERIC on the
>field statement along with any of the numeric field statement parameters
>such as a suitable picture clause and a values clause. PowerHouse will 
>quite
>happily refuse non-numeric entries, will accept the "-" and the "+" and 
>with
>appropriate picture will deal with the decimal point correctly.
>
>Stop fighting the tool :-)
>
>
>-----Original Message-----
>From: Thomson, Martyn EDUC:EX [mailto:Martyn.Thomson@gems1.gov.bc.ca]
>Sent: Tuesday, May 18, 2004 4:24 PM
>To: POWERHOUSE NEW (E-mail)
>Subject: Testing for numeric input
>
>
>Hello listers,
>Does anyone know of a simple way to test if the input to a text field is
>numeric within a range -999.99 to +999.99 with the "+" being optional.
>Using NCONVERT(fieldtext) causes a data expression error when the argument
>is not numeric.
>I looked at matching against every possible pattern the user could enter,
>but since the "-","+" and "." are optional on input, and the range has be
>taken into account, the number of combinations soon gets unmanageable.
>I could loop through each character matching against characters 0 to 9 , . 
>-
>+  but then coding to ensure that the plus, negative and period characters
>are in appropriate positions and not repeated, also soon becomes lengthy.
>There must be a more elegant method eh?
>
>Regards,
>Martyn Thomson
>Ministry of Education, Victoria, BC
>
>
>
>

_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN 
Premium! http://join.msn.click-url.com/go/onm00200439ave/direct/01/