Alpha Video Training
Results 1 to 10 of 10

Thread: Remove Characters from an expression

  1. #1
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Remove Characters from an expression

    I know there must be a way. I have a character field which contains numbers and characters but would like to extract only the numbers. Any help would be appreciated.

  2. #2
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,388

    Default Re: Remove Characters from an expression

    This raises so many questions.
    Are the letters and number grouped ?
    What is the max length of the column?
    Providing samples of what you have (component, sample data) make it much easier to help you.

  3. #3
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,117

    Default Re: Remove Characters from an expression

    perhaps what you want is to remove all the characters leaving the numbers? remspecial should work...and that may be an answer to my own question in another thread, lol
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  4. #4
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Re: Remove Characters from an expression

    There are many different scenarios for the data. Here are a few examples: A-22124, ME11578, G00045318, G12178. There is absolutely no consistency and that is where the problem lies.

  5. #5
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Re: Remove Characters from an expression

    Thanks Charles. Remspecial only removes not alpha/numeric characters. I want to remove everything except for numeric characters.

  6. #6
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,117

    Default Re: Remove Characters from an expression

    right so do you want the numbers? remspecial leaves ONLY the numbers behind, do you want the dashes as well?
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  7. #7
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Re: Remove Characters from an expression

    No, remspecial also leave characters. For example: Remspecial("A-22124") results "A22124" I only want the numbers.

  8. #8
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,198

    Default Re: Remove Characters from an expression

    Make a UDF and call it with the input value

    Code:
    dim shared vx as C="qw35qw2345"
    ONLY_NUMBERS(vx)
    msgbox(only_numbers)
    
    FUNCTION only_numbers as V(input as C)
    only_numbers=""
    dim vchr_now as C
    dim vn as N=len(vx)
    for i = 1 to vn
    	vchr_now=substr(vx,i,1)
    	if isnumber(vchr_now)
    		only_numbers=only_numbers+vchr_now
    	end if
    next
    END FUNCTION
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  9. #9
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Remove Characters from an expression

    Take a look at the regex_split() Xbasic function.

    Code:
    ?REGEX_SPLIT( "G00045318 and fast times 3 dot 4" , "([0-9]+)")
    = 00045318
    3
    4
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  10. #10
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Re: Remove Characters from an expression

    REGEX_SPLIT works perfectly. Thank you!

Similar Threads

  1. How to remove first seven characters in a calculated field?
    By JimGatton in forum Alpha Five Version 7
    Replies: 11
    Last Post: 11-23-2012, 12:01 AM
  2. Extra Characters at end of Expression
    By Dan Blank in forum Application Server Version 8
    Replies: 1
    Last Post: 11-10-2007, 03:07 PM
  3. Function to remove the first 3 characters of field
    By George Corder in forum Alpha Five Version 8
    Replies: 2
    Last Post: 10-10-2007, 06:05 PM
  4. Remove Alpha Characters
    By Jerry Hartness in forum Alpha Five Version 4
    Replies: 4
    Last Post: 02-09-2001, 08:29 AM
  5. TOO MANY CHARACTERS IN EXPRESSION
    By RALPH WHALEY in forum Alpha Five Version 4
    Replies: 4
    Last Post: 05-12-2000, 08:29 PM

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
  •