Alpha Video Training
Results 1 to 7 of 7

Thread: FORCE NUMERIC NOT EQUAL "BLANK"

  1. #1
    ken tjia
    Guest

    Default FORCE NUMERIC NOT EQUAL "BLANK"

    I HAVE A SITUATION WHERE I NEED TO ENTER NUMBER DIRECTLY INTO A FIELD ON A FORM. THIS WORKS VERY WELL AND SINCE THERE ARE MORE THAN 10 FIELD THAT THE USER NEED TO ENTER QTY VALUE///

    THE FIELD ITSELF IS A "NUMERIC"

    AFTER CAREFUL INVESTIGATION ON APPLICATION CRASHES//

    I DISCOVERED THAT WHEN SOMEONE ENTER A BLANK INTO THE FIELD INTENTIONALLY ? THE APPLICATION WILL EVENTUALLY CRASH ALONG WITH OTHER OPERATION COMBINATIONS OF KEY STROKES.

    I OPT THE IDEA TO PUT CODE WITHIN THE FIELD_RULE OF THE TABLE'S FIELDRULE'S EVENTS

    CANWRITEFIELD....

    IF A_FIELD_VALUE=""
    A_FIELD_VALUE=0
    END IF

    ETC....

    THAT DOESNOT SEEMS TO MAKE ANY DIFFERENCE
    WHEN I ENTER BLANK INTO THAT PARTICULAR NUMERIC FIELD
    IT STILL REMAIN "BLANK"

    YOUR ADVICE AMD REMEDY IS GREATLY APPRECIATED
    THANKS
    KEN TJIA

  2. #2
    Vince McGinnis
    Guest

    Default RE: FORCE NUMERIC NOT EQUAL

    Ken,

    Not sure I can be of any help, but check out the MATH_NAN costant in Xbasic.

    Here is something Cian Chambliss posted a while ago, that may get you started:

    Msg ID: 34378
    Subject:
    RE: Numeric 0 vs. numeric blank
    Author: cian chambliss
    Date: 01-29-2001 09:27
    File: Unitialized numeric fields in A5 contain the value of non-a-number
    (represented by the constant MATH_NAN) -- here is an example done in
    the a5v4 script editor interactive window:

    x = 0
    ? isblank("var->x")
    = .F.


    x = math_nan

    ? isblank("var->x")
    = .T.

  3. #3
    ROBERT SULLIVAN
    Guest

    Default RE: FORCE NUMERIC NOT EQUAL

    IF FIELD="" IS NULL

    TRY IF FIELD=" " WITH A BLANK BETWEEN QUOTES

    BOB

  4. #4
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: FORCE NUMERIC NOT EQUAL

    Hi Ken,

    Could you somehow force a zero into the field if it is blank, perhaps testing the text property of the control on the form. I believe even controls bound to numeric fields have a text property: the characters in the control as opposed to the value in the field.

    On departing the field if controlname.text="" set it to "0".

    Bill

  5. #5
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default RE: FORCE NUMERIC NOT EQUAL

    Have you tried to give the field a default value of 0.00. A nul value has a character value and therefore cannot be calculated with numbers.

    Keith Hubert
    London.

  6. #6
    Mick Magnuson
    Guest

    Default RE: FORCE NUMERIC NOT EQUAL

    You can also force a zero by using the OnDepart action event for the field on the form. This will change an entered space to a numeric zero.


    VMODE=YOUR_FORM_NAME.MODE_GET() 'get entry mode-script will not fire in view mode
    SELECT
    CASE VMODE="ENTER".OR.VMODE="CHANGE"
    TBL=TABLE.CURRENT()
    IF TBL.YOUR_FIELD_NAME=0
    TBL.YOUR_FIELD_NAME=0
    YOUR_FIELD_NAME.REFRESH()
    END
    END IF
    END SELECT

    Mick

  7. #7
    "Certified" Alphaholic
    Real Name
    Peter Wayne
    Join Date
    Apr 2000
    Posts
    1,728

    Default RE: FORCE NUMERIC NOT EQUAL

    try

    if a_field_value="" then
    a_field_value="0"
    end if

Similar Threads

  1. Field to display "blank" If....
    By czar_g in forum Alpha Five Version 6
    Replies: 9
    Last Post: 10-17-2005, 01:21 PM
  2. High-lighting "Nearly" equal values
    By Graham Wickens in forum Alpha Five Version 5
    Replies: 6
    Last Post: 04-20-2005, 12:30 PM
  3. "Enter new record"...not blank
    By Paul Simison in forum Alpha Five Version 5
    Replies: 24
    Last Post: 03-03-2005, 10:37 AM
  4. Previous not "locked" to "Auto"
    By Richard Froncek in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-05-2003, 01:03 PM
  5. Convert "02" to "2002"
    By Tony Watts in forum Alpha Five Version 5
    Replies: 4
    Last Post: 01-03-2003, 06:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •