Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

LastName, Firstname

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    LastName, Firstname

    I just created this code to convert a Firstname Lastname into a Lastname, Firstname:

    substr(alltrim(firstlast),(len(alltrim(Firstlast))-rat(" ",alltrim(Firstlast),1)+2),50)+", "+substr(Firstlast,1,at(" ",alltrim(Firstlast),1)-1)

    ...where Firstlast is the name of field containing the Firstname Lastname.

    What I can't figure out is how to handle "Jr's", middle initials, etc.

    Anyone have a good solution?

    Charlie

    #2
    RE: LastName, Firstname

    Charles:
    A much simpler approach:
    word(fullname,2)+" "+word(fullname,1)+" "+word(fullname,3)


    dim fullname as c
    fullname="charles Hoens Jr."
    ?word(fullname,2)+" "+word(fullname,1)+" "+word(fullname,3)
    = "Hoens charles Jr"

    fullname="Charles Hoens"
    ?word(fullname,2)+" "+word(fullname,1)+" "+word(fullname,3)
    = "Hoens Charles "


    Gabe

    Comment


      #3
      RE: LastName, Firstname

      Obviously you have a structure problem. It might be possible to construct an expression that allowed for all the possibilities, but as the other response indicates, you would have to go to great lengths reassemble the name parts considering that you might have

      firstname lastname
      firstname midinitial lastname
      firstname middlename lastname
      firstname lastname sufffix
      firstname midinitial lastname suffix
      firstname middlename lastname suffix

      and likely other combinations.

      You need fields for each of the parts, requiring only those you have to have, and assemble the parts in whatever order you want at the appropriate time.
      There can be only one.

      Comment


        #4
        RE: LastName, Firstname

        Charlie,
        I really don't understand why there are substr and len operators in your formula. I also don't understand the -rat part of the formula. When I have to deal with names, I usually have a last field and a first field. The formula to concatenate them would be alltrim(first)+" "+alltrim(last). If I want last name first I reverse them and put ", " in the middle.
        I happen to be a Jr. myself and when I fill out forms that need the Jr. I simply put Urbanski, Jr. in the last name field.
        I just looked back at your question and I'm not sure I understand if your situation has the names in two fields or one. I assume they're in two fields an you want to revrse the order. If they are in one field, that's beyond my skill level.

        Jim

        Comment


          #5
          RE: LastName, Firstname

          I just reread your post and see that you have only one field. There is a genie in the operators but I don't think that will address your situation. Sorry I can't be more help.

          Jim

          Comment


            #6
            RE: LastName, Firstname

            Well, I'm probably going to have to create a UDF in order to trap all the problems. The Word() function is the way to go - I did it the old fashioned way - brute force!

            But I ran into people who used one letter as their first names "H. Ross Perot", some who had two or three middles initials and of course several Sr's, Jr's and III's.

            Alpha is so good now, that I guess I now am at the point that I expect that there is a solution for everything that someone has thought of.

            I'll get to work on that UDF!

            Charlie

            Comment


              #7
              RE: LastName, Firstname

              dim fullname as c
              fullname="H. Ross Perot Jr."
              ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(len(word(fullname,1))=1,word(fullname,1," ",2),word(fullname,1))+" "+word(fullname,w_count(fullname))
              = "Perot H. Ross Jr"

              Gabe

              Comment


                #8
                RE: LastName, Firstname

                Thanks Gabe. This is great. I'm working on the function and will post it when I get it done with many thanks to you!

                Charlie

                Comment


                  #9
                  RE: LastName, Firstname

                  Sorry, I vote for the udf.

                  nm1 = "Oscar De La Hoya"
                  nm2 = "John Ronald Reuel Tolkien"
                  nm3 = "John Paul II"


                  ? if(right(nm1,3)="Jr.".or.right(nm1,3)="Sr.",word(nm1,w_count(nm1)-1),word(nm1,w_count(nm1)))+" "+if(len(word(nm1,1))=1,word(nm1,1," ",2),word(nm1,1))+" "+word(nm1,w_count(nm1))
                  = "Hoya Oscar Hoya"

                  ? if(right(nm2,3)="Jr.".or.right(nm2,3)="Sr.",word(nm2,w_count(nm2)-1),word(nm2,w_count(nm2)))+" "+if(len(word(nm2,1))=1,word(nm2,1," ",2),word(nm2,1))+" "+word(nm2,w_count(nm2))
                  = "Tolkien John Tolkien"

                  ? if(right(nm3,3)="Jr.".or.right(nm3,3)="Sr.",word(nm3,w_count(nm3)-1),word(nm3,w_count(nm3)))+" "+if(len(word(nm3,1))=1,word(nm3,1," ",2),word(nm3,1))+" "+word(nm3,w_count(nm3))
                  = "II John II"
                  There can be only one.

                  Comment


                    #10
                    RE: LastName, Firstname

                    Such an expression may not handle all of the scenarios which Stan laid out:

                    fullname="George H. W. Bush"
                    ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(len(word(fullname,1))=1,word(fullname,1," ",2),word(fullname,1))+" "+word(fullname,w_count(fullname))
                    = "Bush George Bush"

                    So a more complete UDF may be the way to go.

                    Comment


                      #11
                      RE: LastName, Firstname

                      The underlying difficulty is that the structure of the original string is presumably not consistent from record to record.

                      Instead of just a firstname and a lastname, it's possible I suppose to actually need:

                      Title
                      Firstname
                      Middlename
                      Lastname
                      Suffix

                      Even if the data doesn't include titles you can't know in advance if a 3 word combination is first, middle, last or first, last, suffix.

                      Here are some tips I've found useful in the past:

                      If middlename is actually just an initial throughout all records then the length of the second term could be used to classify it.

                      If the word before the "last" word includes a trailing comma, then the last word is a suffix.

                      w_count() can be used to classify two word and 4 word combinations.

                      It's the three word combinations that always drove me nuts.

                      I've sometimes wondered if it would make sense to present a list of the 3 word strings and ask the user to tell you (a) is this f, m, l or is this f, l, s ?

                      -- tom

                      Comment


                        #12
                        RE: LastName, Firstname

                        dim fullname as c
                        fullname="George H W Bush Jr."
                        ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,1," ",w_count(fullname)-2)+" "+right(fullname,3), word(fullname,1," ",w_count(fullname)-1))
                        = "Bush George H W Jr."

                        Any other wacky names??

                        Gabe

                        Comment


                          #13
                          RE: LastName, Firstname


                          dim fullname as c
                          fullname="George H W Bush Jr."
                          ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,1," ",w_count(fullname)-2)+" "+right(fullname,3), word(fullname,1," ",w_count(fullname)-1))
                          = "Bush George H W Jr."

                          fullname="Oscar De La Hoeya"
                          ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,1," ",w_count(fullname)-2)+" "+right(fullname,3), word(fullname,1," ",w_count(fullname)-1))
                          = "Hoeya Oscar De La"

                          Any other wacky names??

                          Gabe

                          Comment


                            #14
                            RE: LastName, Firstname

                            Any more??

                            dim fullname as c
                            fullname="Stan Steve Tom Cone Jr."
                            ??if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,1," ",w_count(fullname)-2)+" "+right(fullname,3), word(fullname,1," ",w_count(fullname)-1))
                            ="Cone Stan Steve Tom Jr."

                            Gabe

                            Comment


                              #15
                              RE: LastName, Firstname

                              Let's get really wacky:
                              dim fullname as c
                              fullname="Charles Gabe S Steve T Cone Jr."
                              ?if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,w_count(fullname)-1),word(fullname,w_count(fullname)))+" "+if(right(fullname,3)="Jr.".or.right(fullname,3)="Sr.",word(fullname,1," ",w_count(fullname)-2)+" "+right(fullname,3), word(fullname,1," ",w_count(fullname)-1))
                              ="Cone Charles Gabe S Steve T Jr."

                              I am out of wacky names !!
                              Gabe

                              Comment

                              Working...
                              X