Alpha Video Training
Results 1 to 12 of 12

Thread: Inverting a Fullname

  1. #1
    Member SMARTII's Avatar
    Real Name
    TOM MCCANN
    Join Date
    Jul 2007
    Location
    Grand Prairie TX
    Posts
    197

    Default Inverting a Fullname

    In my old application I could define a field as INVERTED:
    Field type: Inverted Alpha Numeric Counter Date Time
    My A5 application Imports from external TEXT files (over which I have no control) that only have a Fullname field:
    Paul J Kosko,Jr
    The Key or index would then sort by:
    Kosko,Jr Paul J
    If I opened on the index, the order would be:
    ROBERT M BANKSTER
    PAUL J KOSKO
    ALLEN A MCMANN
    If you did a search you would enter Kosko instead of Paul J Kosko,Jr
    Also, the user prints File Folder Labels where they want the first 4 of the Last Name:
    K
    O
    S
    K
    on the edge of the label in BIG letters so it's easy to find a name in the vertical folder storage, where there are 1000's of folders.
    So, I have to have a Last Name isolated to do this.
    There are many exceptions to this "invert" :
    Ex:
    AMERICAN INSULATION INC. (I'd want (AMER). I don't want INC
    THE DOROTHY WEST GROUP LLC (I'd want WEST). I don't want LLC or GROUP or THE. ie WEST GROUP LLC THE DOROTHY. or
    at least DOROTHY WEST GROUP LLC THE
    The invert type field took care of 85%. The 15% where inverted key/index sort would create a mess as above, I had to write a yarnball UDF to test if the name indicated a Company or Title or Both, and no adjectives at the beginning and ignore titles at the end: LLC INC CO CO. DDS PHD. N.A. III etc. Even then some would slip through.

    I've searched the archives for "invert" and nothing relates that I found.
    Any Ideas?

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

    Default Re: Inverting a Fullname

    Quote Originally Posted by SMARTII View Post
    Any Ideas?
    Ask a question if you have one.

    Do you want to know how to search for Kosko in a fullname field? Try using Full Text Indexing.

    If you want to order by lastname for proper names and significant word in company names I think you'll have to redo your udf in the current version of Alpha. Only you can determine what the significant word might be. You might consider adding a single character field to indicate whether the full name is proper or company which your udf could utilize.
    There can be only one.

  3. #3
    Member SMARTII's Avatar
    Real Name
    TOM MCCANN
    Join Date
    Jul 2007
    Location
    Grand Prairie TX
    Posts
    197

    Default Re: Inverting a Fullname

    Sorry, the q. would be how to isolate the last name.
    q2. would be is there an A5 function that at least does this on a simple proper name as in MARY T GIOVANNI returns GIOVANNI MARY T

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

    Default Re: Inverting a Fullname

    Not a single function but many functions to do what you want. One way ...

    Code:
    nme = "MARY T GIOVANNI"
    
    ? word(nme,3," ")+" "+word(nme,1," ",2)
    = "GIOVANNI MARY T"
    There can be only one.

  5. #5
    Member jaryder's Avatar
    Real Name
    Jeff Ryder
    Join Date
    May 2006
    Location
    Two Harbors, MN
    Posts
    349

    Default Re: Inverting a Fullname

    Tom,

    Here is some code that I have on a full name field that tries to properly switch person's name to last name first.

    Jeff Ryder to Ryder Jeff
    Jeff A Ryder to Ryder Jeff A
    Jeff A Ryder III to Ryder III Jeff A
    Jeff Ryder JR to Ryder JR Jeff
    Jeff de Ryder to de Ryder Jeff

    Code:
    dim vStr as c
    dim vNum as n
    vStr=topparent:name.text
    vNum=w_count(vStr)
    
    'parse name to try to create sort key
    select
        case vNum = 2
        	topparent:sortkey.value=word(vStr,2) + " " + word(vStr,1)
        case vNum = 3
        	if len(word(vStr,2)) = 1 then
        		topparent:sortkey.value=word(vStr,3) + " " + word(vStr,1," ",2)
        	else
        		topparent:sortkey.value=word(vStr,2," ",2) + " " + word(vStr,1)
         	end if
        case vNum = 4
        	topparent:sortkey.value=word(vStr,3," ",2) + " " + word(vStr,1," ",2)
        case else
        	topparent:sortkey.value=vStr
    end select
    Jeff Ryder

  6. #6
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Inverting a Fullname

    There was a thread from well over a year ago dealing with exactly this same issue. Will take some search to find it but it covers it pretty well specially unusal names e.g. Oscar de La Hoya, George Herbert Walker Bush or names ending with different suffix etc.

  7. #7
    Member SMARTII's Avatar
    Real Name
    TOM MCCANN
    Join Date
    Jul 2007
    Location
    Grand Prairie TX
    Posts
    197

    Default Re: Inverting a Fullname

    Quote Originally Posted by G Gabriel View Post
    There was a thread from well over a year ago dealing with exactly this same issue. Will take some search to find it but it covers it pretty well specially unusal names e.g. Oscar de La Hoya, George Herbert Walker Bush or names ending with different suffix etc.
    Now if only I can find the right search words.. that won't give me 500 threads.

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

    Default Re: Inverting a Fullname

    Uh, think those might be the search words?
    There can be only one.

  9. #9
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Inverting a Fullname

    Here you go.

  10. #10
    Member SMARTII's Avatar
    Real Name
    TOM MCCANN
    Join Date
    Jul 2007
    Location
    Grand Prairie TX
    Posts
    197

    Default Re: Inverting a Fullname

    Quote Originally Posted by G Gabriel View Post
    Here you go.
    I thank you all for your input on this.
    I examined 3 clients records for the last 8 months (about 8,000 names). These names are all on Legal documents of registered property
    First, many were Entities other than an individual.
    Those I don't want to invert. The only thing I want to do is remove any common prefix adjectives. The only one I found in the sample was "THE ".
    That had to be removed. Otherwise use the Entity as is.
    How to tell if it's an Entity other than an individual?
    Create a list of all the indicators in the name that would point to it being an Entity:
    companylist = <<%a%
    %a%
    and compared with the fullname to see if a company-like indicator exists in the fullname.
    '------------
    Next I had the individuals with all kinds of titles.
    The titles and variations were put into another List:
    titlelist = <<%b%
    %b%
    and compared with the fullname to see if a title exists in it.
    The title gets stripped from the name leaving and untitled common name.
    Then the last name is taken from that untitled name.
    Then Invert takes place.
    '------------
    The nice thing about the lists is that you can easily add to them as necessary with no other fuss.
    '------------
    Finally there is the untitled individuals.
    The Invert takes place.
    '------------
    I did use a GOTO "DONE" label instead of an EXIT FUNCTION.
    So, spank me..

    I invite anyone to find a combo where it fails as intended.
    Then I can work on it some more.

    I especially thank jaryder and
    G Gabriel

    Ok:
    Here it is:
    PHP Code:
    FUNCTION invrtnam AS (fulnam AS )
    Dim iscomp as c
    Dim istitle 
    as c
    Dim prefx 
    as c
    Dim spc 
    as c
    Dim coma 
    as c
    Dim newnam 
    as c
    Dim compnam
    Dim titlelen 
    as n
    spc 
    chr(32)
    coma chr(44)
    If 
    left(fulnam,3)= "THE"
     
    compnam mid(fulnam,5)+spc+"THE"
        
    invrtnam compnam
     
    goto DONE
    end 
    if
    '-------- Do not Invert a Company type ----
    companylist = <<%a%
    CO
    CO.
    INC
    INC.
    INC/
    LTD
    LTD.
    LLC
    LLC.
    BANK
    BANC
    SERVICES
    INVESTMENTS
    LP
    CORP
    CORP.
    COMPANY
    OF
    LP
    LT
    INDUSTRIES
    AGENCY
    SPECIALIST
    PRODUCTION
    PLUMBING
    USA
    ENTERPRISES
    ENTERTAINMENT
    GROUP
    %a%
    '
    ------------
    iscomp word_in_common(fulnam,companylist,spc)
    if 
    iscomp <> ""
      
    compnam fulnam
      invrtnam 
    compnam
      
    goto DONE
    end 
    if
    '------------ It's a Person -------- 
    'Personal names will then be inverted
    titlelist = <<%b%
    II
    IV
    JR
    SR
    MD
    MD.
    MD PA
    M.D. PA
    MD,PHD
    MD,PHD.
    DDS
    DDS,INC.
    DDS,INC.
    II
    III
    IV
    PHD
    PHD.
    LSE
    (LESSEE)
    LESSEE
    PA
    PA.
    MD
    PC
    CPA
    CPA.
    %b%
    '
    ------------
    istitle word_in_common(fulnam,titlelist,spc)
    titlelen len(istitle)
    if 
    titlelen >0  ' remove the title b4 inverting
      notitlenam = left(fulnam,len(fulnam)-titlelen -1)
      lastnam = lastword(notitlenam)
      newnam = \
      lastnam + spc + istitle + spc + left(notitlenam,len(notitlenam)-len(lastnam)-1)
      invrtnam = newnam 
    else
      titlelen = len(fulnam)
      lastnam = lastword(fulnam)
      newnam = lastnam + spc + left(fulnam,titlelen - len(lastnam)- 1)
      invrtnam = newnam
    end if
    DONE:
    END FUNCTION 
    Last edited by SMARTII; 11-05-2009 at 09:24 PM.

  11. #11
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Inverting a Fullname

    How about "Joe Richman Bank"?
    There is actually a guy by that name, I am not making it up.

  12. #12
    Member SMARTII's Avatar
    Real Name
    TOM MCCANN
    Join Date
    Jul 2007
    Location
    Grand Prairie TX
    Posts
    197

    Default Re: Inverting a Fullname

    Quote Originally Posted by G Gabriel View Post
    How about "Joe Richman Bank"?
    There is actually a guy by that name, I am not making it up.
    As long as he's not in Texas....
    I also found a Yang Zu INN as a person.
    as in
    Rusty Canyon INN
    I guess I could remove BANK because nearly all banks include NA or N.A.
    Last edited by SMARTII; 11-05-2009 at 09:16 PM.

Similar Threads

  1. Inverting Table Info
    By H. Donnell in forum Alpha Five Version 6
    Replies: 12
    Last Post: 05-20-2005, 11:18 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
  •