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

state abbreviations

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

    state abbreviations

    Is there a function that does just the opposite of cstate? I want to take a full state name, Kentucky, and get KY. Have searched and searched, I can't seem to find one.

    Thanks,
    Alan

    #2
    RE: state abbreviations

    Alan,

    I don't see one but it would be easy to throw together a solution since there are only 50 states and 10 Canadian provinces--to match the cstate() function.

    Either create a lookup table that accepts a state-province and yields an abbreviation or create a function and use the select-case function. YOu can use the cstates() function to test for valid imput.

    Bill
    Bill Hanigsberg

    Comment


      #3
      RE: state abbreviations

      Alan,

      I kinda' hate to state (no pun intended) the obvious, but why don't you build a simple lookup table to do this?

      Dave
      Dave Jampole
      www.customalpha.com

      Women and cats will do whatever they want. The sooner men and dogs realize that, the happier they will be.

      Comment


        #4
        RE: state abbreviations

        I have imported a file that has the city, state, and zip in one string. I need to create 3 seperate fields for this information, which I have already done. Unfortunately, the state field is not uniform. Some have abbreviations and some have the full state name. I want to convert them all to abbreviations.

        Comment


          #5
          RE: state abbreviations

          Alan,

          Post your data and perhaps someone can help you with the variabilities.

          Meanwhile, on the original question, since cstates() generates a list of states we don't need a table with that information as we can look up the position of the state in the list and then find the abbreviation from cstates("a").

          The following shows how. It would be easy to base a custom function on this.

          Bill

          ?wordat("New York",cstates(),crlf())
          = 33.000000
          pos=2*(wordat("New York",cstates(),crlf()))-1
          ?substr(cstates("a"),pos,2)
          = 65
          stateab=substr(cstates("a"),pos,2)
          ?stateab
          = "NY"

          statename="Ontario"
          pos=2*(wordat(statename,cstates(),crlf()))-1
          stateab=substr(cstates("a"),pos,2)
          ?stateab
          = "ON"
          Bill Hanigsberg

          Comment


            #6
            RE: state abbreviations

            FUNCTION stateabb AS C (statename AS C )
            statelist=stritran(cstates(),crlf(1),space(1))
            select
            case .not.*wordi(statelist,statename) 'not a valid state name so return an error
            stateabb = "err"
            case else
            pos=2*(wordat(statename,cstates(),crlf()))-1
            stateabb=substr(cstates("a"),pos,2)
            end select
            END FUNCTION
            Bill Hanigsberg

            Comment


              #7
              RE: state abbreviations

              William,

              Thanks for the input. I have already come up with a function that in a way is a lot simpler , but a lot longer than yours. I used 51 case selects. It works, not as fancy as yours. I do like yours and am going to study it. To be honest, I have not reached that level of programing yet. Someday I hope to be though. Thanks again for you efforts, it is greatly appreciated.

              Alan

              Comment


                #8
                RE: state abbreviations

                Alan don't forget there are many more than 51 State Abbreviations. Be sure to check the Official USPS List so you include:
                AS, FM, GU, MP, PR, VI, AE, AA & AP

                (hope I didn't forget any others).

                -Baqrry

                Comment


                  #9
                  RE: state abbreviations

                  Just type

                  ?cstates()

                  in the interactive window to see the full list.

                  Bill
                  Bill Hanigsberg

                  Comment


                    #10
                    RE: state abbreviations

                    Hi Bill:
                    Tried cstates() and FYI, it shows (see below) several errors in list of Canadian Provinces and Territories:

                    Missing are: Manitoba MB
                    Nunavut NU

                    Manitoba has been a province since 1870 - no idea why it would be missing.

                    Nunavut (NU) territory split from Northwest Territories(NT) on 1999-04-01. Canada Post continued to use NT as the designator for both Nunavut and Northwest Territories until 2000-12-12. The reason for the delay was typical of Canadian beaurocracy - Canada Post was worried that the "naughty connotation" of the french translation would offend francophones. 'nu' means naked or nude in french. Canada Post was considering NN, but many mailers, including government employees, and the territories phone company Northwestel (in their 1999/2000 directory) began using NU anyway so they finally caved in.

                    Duplicate: Quebec (code was PQ, now officially QC)

                    The Canada Post designator for Quebec was PQ, for "Province du Qu�bec", until 1993 when it was changed to the current QC.

                    Incorrect: Newfoundland and Labrador (code was NF, now officially NL)

                    The name of Canada's most easterly province was changed from Newfoundland to Newfoundland and Labrador on 2001-11-20. Canada Post changed the postal designator from NF to NL on 2002-10-21.

                    Canadian province codes are at http://www.canadapost.ca/personal/tools/pg/manual/b03-e.asp#c013

                    Current cstates() list:
                    Alberta
                    Ontario
                    British Columbia
                    Prince Edward Island
                    New Brunswick
                    Newfoundland
                    Saskatchewan
                    Nova Scotia
                    Yukon
                    Northwest Territories
                    Quebec
                    Quebec

                    Comment


                      #11
                      RE: state abbreviations

                      Robert, there's little that Bill can do about this. He doesn't work for AlphaSoftware. Why not send your findings to Ed Larrabee or Selwyn Rabins at Alpha ?

                      -- tom

                      Comment


                        #12
                        RE: state abbreviations

                        Hi again,

                        Tom, Bob knows me and that I do not work for AS. (He even put me up in his home one night when I was in Ottawa.) What's more, he's done us all a service by actually verifying the list cstates() generates which it never occurred to me to do.

                        At a deeper level, Bob's discovery highlights the difficulty in relying on a function to generate what is, after all, data.

                        Data can change and when it does we should not have to rewrite functions whether user defined or built in. In my opinion this argues for the lookup table approach to the problem.

                        I'll call this thread to Ed's attention.

                        Bill
                        Bill Hanigsberg

                        Comment


                          #13
                          RE: state abbreviations

                          Hi Tom:
                          Yes indeed, I should have cc'd Ed. Glad to see Bill has followed up and done so.
                          Bob

                          Comment

                          Working...
                          X