Alpha Video Training
Results 1 to 5 of 5

Thread: converting numeric to character data

  1. #1
    Oran Charlson
    Guest

    Default converting numeric to character data

    Attempting to convert numeric w/two decimals to character string w/o decimal.
    i.e. 35.90 to 3590. str(field) returns whole number; substr(field,4,2) returns decimal and (field,4,0) returns whole number. Tried substr(TOTAL,1,4) + substr(TOTAL,6,2) but continually receive operand type mismatch.
    Tried using a character field to calculate the numeric field.
    Tried using a numeric field to calculate the numeric field.
    I'm exhausted.

  2. #2
    Oran Charlson
    Guest

    Default RE: converting numeric to character data

    I got it. STR(TOTAL*100)
    still would like to know why substr(total,1,4) won't extract the digits.

  3. #3
    "Certified" Alphaholic
    Real Name
    Ken Herrold
    Join Date
    May 2000
    Posts
    1,081

    Default RE: converting numeric to character data

    Wonder if 'remspecial' would take it out.

    Ken

  4. #4
    Oran Charlson
    Guest

    Default RE: converting numeric to character data

    Remspecial works fine. Thank you.

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: converting numeric to character data

    In "English" the expression substr(total,1,4) says

    return 4 consecutive characters of the object named "total" starting at the first position. Since total is a number, not a character string, Alpha has no idea how to perform the requested action.

    This is similar to

    text = "ABCD"

    val(text) = ?

Similar Threads

  1. Numeric to Character Conversion
    By scoooby in forum Alpha Five Version 4
    Replies: 3
    Last Post: 08-20-2004, 08:46 AM
  2. Converting Character to Numeric
    By Red Abicht in forum Alpha Five Version 4
    Replies: 1
    Last Post: 10-03-2002, 10:12 AM
  3. Calculations-numeric from character
    By Marilyn in forum Alpha Four Version 6 and Prior
    Replies: 3
    Last Post: 02-15-2002, 06:41 AM
  4. Numeric to Character
    By Thomas Holt in forum Alpha Five Version 4
    Replies: 2
    Last Post: 09-07-2000, 06:03 AM
  5. Converting character to a date field?
    By Howard Berg in forum Alpha Five Version 4
    Replies: 14
    Last Post: 05-11-2000, 07:30 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
  •