AnsweredAssumed Answered

How do I count the words to a coma?

Question asked by illbe on Dec 4, 2012
Latest reply on Dec 6, 2012 by JimMac

Title

How do I count the words to a coma?

Post

     OK, once again I am in word count hell. I have an external db that has names all in one field (God I hate that!). I have a set of simple scripts that successfully pull out the last name, first name, and suffux (JR., SR, etc.). This seems to work fine until I am face with a business name like: BULLS EYE MARKSMAN, LLC, The, or worse yet: DOBSON II, AC NMN.

     I'm not sure how the heck to parse this weirdness.

     Here is my first name script:

     Case (
     Position ( name ; ","; 1; 1) ≠ 0  and MiddleWords(name; 2;1)="JR"; MiddleWords(name; 3;1);
     Position ( name ; ","; 1; 1) ≠ 0  and MiddleWords(name; 2;1)="SR"; MiddleWords(name; 3;1);
     Position ( name ; ","; 1; 1) ≠ 0  and MiddleWords(name; 2;1)="II"; MiddleWords(name; 3;1);
     Position ( name ; ","; 1; 1) ≠ 0  and MiddleWords(name; 2;1)="III"; MiddleWords(name; 3;1);
     Position ( name ; ","; 1; 1) ≠ 0; MiddleWords(name; 2;1)
     )

     Which works fine except for the above

     Here is my lanst name script:

      

     If ( Position ( name ; ","; 1; 1) = 0; LeftWords ( name ; 10 ) ;   LeftWords ( name ; 1 ))

     Which also works fine except for the above

     Ultimately I need to have a result like: Last Name:BULLS EYE MARKSMAN First Name:LLC not Last Name:BULLS First Name:EYE.

     My aplologies for picking so many brains lately but even though my FM knowledge is getting stonger my head may explode :-)

      

     Thank you in advance

      

     Tom

      

Outcomes