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

zip code quandary

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

    zip code quandary

    I am trying to update a zip field and have run into a little difficulty. All of the data is in dbf format and the table has been added to my application. The contacts are a mix of US, Canada, and Mexico so the zip codes range from the standard xxxxx, xxxxx-xxxx, and XXX XXX format.

    If they were only the US I would be ok and could break out the xxxxx-xxxx into two fields of 5 and 4 respectively, but the countries XXX XXX format has me stumped.

    Any ideas?

    Thanks
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

    #2
    Re: zip code quandary

    Hi Cheryl,
    I believe you can create a conditional mask in field rules which you could base on the country value.

    I think this would work the same in your update. Make three different conditions, one for each country. If you have some formatting in the fields already that needs to change, you could remove that first in an update, then update again with the conditions.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: zip code quandary

      Hi Robin,

      Thanks for the idea. I currently have three zip fields in my db:

      zip, c, 5
      zip4, c, 4
      zip6, c, 7

      What I am trying to do is get the data from the added dbf into those three different fields. I can use an update operation to break out the zip 5 and zip 4 but I do not know what to tell it to determine that if the zip is XXX XXX that instead of the 5/4 breakout I need that data in the zip6 field.
      Cheryl
      #1 Designs By Pagecrazy
      http://pagecrazy.com/

      Comment


        #4
        Re: zip code quandary

        Originally posted by Cheryl Lemire
        Hi Robin,

        Thanks for the idea. I currently have three zip fields in my db:

        zip, c, 5
        zip4, c, 4
        zip6, c, 7

        What I am trying to do is get the data from the added dbf into those three different fields. I can use an update operation to break out the zip 5 and zip 4 but I do not know what to tell it to determine that if the zip is XXX XXX that instead of the 5/4 breakout I need that data in the zip6 field.
        I must be misunderstanding. You want a filter for XXX XXX?

        substr(alltrim(zipfield),4,1)=" "

        for one.
        There can be only one.

        Comment


          #5
          Re: zip code quandary

          You are on the right track Stan. I need to create an update operation that does the following:

          field zip
          expression: if(AT("-", ZIP, 1)>0,SUBSTR(ZIP, AT("-", ZIP, 0)+1, (AT("-", ZIP, 1)-AT("-", ZIP, 0))-1),ZIP)

          field zip4
          expression: if(AT("-", ZIP, 1)>0,SUBSTR(ZIP, AT("-", ZIP, 1)+1, (AT("-", ZIP, 2)-AT("-", ZIP, 1))-1),"")

          field zip6
          expression: no idea how to tell it if the separater is a space to copy it to the zip6 field

          Does that make sense?
          Cheryl
          #1 Designs By Pagecrazy
          http://pagecrazy.com/

          Comment


            #6
            Re: zip code quandary

            Cheryl:
            You added a table to your existing DB.
            The Table has hodgepodge of zip codes in one field. Your existing table has 3 fields for zip codes.
            You want to "triage", so to speak, these hodgepodge zip codes into one of the three fields in your own DB.

            I am not sure why you refer to "update"? You need an append operation.
            In the append operation:
            You append to your existing table (M) from the added table (T).
            m.zip(5)[email protected] condition: len(alltrim(t.zip))=5
            m.zip(4)[email protected] condition: len(alltrimt.zip))=4
            m.zip(7)[email protected] condition: len(alltrimt.zip))=7

            Comment


              #7
              Re: zip code quandary

              Thanks Gabe, but I am not appending the records to my new tables yet.

              I am fixing all the problems in the actual dbf that I added to the application and making all the updates to the temp table before I do any appending.

              When I run my append operations, there will be several as I have multiple tables that different parts of the data will be appended to, I want a smooth append operation.
              Cheryl
              #1 Designs By Pagecrazy
              http://pagecrazy.com/

              Comment


                #8
                Re: zip code quandary

                Originally posted by Cheryl Lemire
                You are on the right track Stan. I need to create an update operation that does the following:

                field zip6
                expression: no idea how to tell it if the separater is a space to copy it to the zip6 field

                Does that make sense?
                field zip6
                expression: if(AT("-", ZIP, 1)=0,zip,"")

                ???????

                Not sure I'm clear where you're working. Have you created a set with the new table as a child to support the update operation?

                After reading your answer to g you seem to be updating the transaction table after adding three fields to hold the three types of zips.
                There can be only one.

                Comment


                  #9
                  Re: zip code quandary

                  That is correct Stan. I have added the fields that I need in my transaction table to coincide with the various real tables and am running update operations to the transaction table so that all of the data is in the format I need.

                  The expressions I noted above I used the update genie to break the zip field into 2 parts with the '-' separater.
                  Cheryl
                  #1 Designs By Pagecrazy
                  http://pagecrazy.com/

                  Comment


                    #10
                    Re: zip code quandary

                    Cheryl:
                    I am not really sure why you are doing that particularly if you are using a temp table. Nonetheless, you could use the same idea to update. But in this case, you will run 3 update operation, one on each of the 3 fields:

                    first one to update the zip(5) field
                    Create new operation "update"
                    If you are using the genie, go to the general tab
                    assign a value based on expression: field with the hodgepodge zip codes
                    when you come to the part that ask: update all, choose selected records and base it on an expression: len(alltrim(zip))=5

                    and so on..
                    If you do that, you wouldn't need any of those expressions you used. But if you have to know the answer to question:
                    field zip6
                    expression: no idea how to tell it if the separater is a space to copy it to the zip6 field

                    The expression
                    occurs(" ",zip7)>0

                    Comment


                      #11
                      Re: zip code quandary

                      Originally posted by Cheryl Lemire
                      That is correct Stan. I have added the fields that I need in my transaction table to coincide with the various real tables and am running update operations to the transaction table so that all of the data is in the format I need.

                      The expressions I noted above I used the update genie to break the zip field into 2 parts with the '-' separater.
                      Was more complicated than I thought.
                      There can be only one.

                      Comment


                        #12
                        Re: zip code quandary

                        Hi Stan,

                        You are the best. Yours did not quite work, but it was all I needed to make it work. For the zip4 field in yours it was not updating the zip field, only the zip4 field. See attached revisions. Thanks a ton!!! Not sure I would have ever figured it out on my own.
                        Last edited by Cheryl Lemire; 09-13-2006, 10:16 AM.
                        Cheryl
                        #1 Designs By Pagecrazy
                        http://pagecrazy.com/

                        Comment


                          #13
                          Re: zip code quandary

                          I was wrong :(

                          STAN ZIP5

                          if(AT("-", ZIP, 1)=0.and.at(" ",alltrim(ZIP),1)=0,left(ZIP,5),"")

                          MY ZIP5

                          if(AT("-", ZIP, 1)>0,SUBSTR(ZIP, AT("-", ZIP, 0)+1, (AT("-", ZIP, 1)-AT("-", ZIP, 0))-1),ZIP)

                          Stan's zip5 correctly places the first 5 characters of the zip code prior to the '-' in the zip 5 field, HOWEVER, it does not put the last 4 characters following the '-' in the zip 4 field

                          My zip5 correctly places the first 5 and last 4 in the zip5 and zip4 fields, HOWEVER, what I just noticed is that for the zips that have the zip6 data, although the zip is properly placed in the zip6 field, it is ALSO placing the first 5 characters into the zip5 field :(

                          Stan, what do I need to add to your expression so that it also places the last 4 of the zip into the zip4 field?
                          Cheryl
                          #1 Designs By Pagecrazy
                          http://pagecrazy.com/

                          Comment


                            #14
                            Re: zip code quandary

                            Originally posted by Cheryl Lemire
                            I was wrong :(

                            STAN ZIP5

                            if(AT("-", ZIP, 1)=0.and.at(" ",alltrim(ZIP),1)=0,left(ZIP,5),"")

                            MY ZIP5

                            if(AT("-", ZIP, 1)>0,SUBSTR(ZIP, AT("-", ZIP, 0)+1, (AT("-", ZIP, 1)-AT("-", ZIP, 0))-1),ZIP)

                            Stan's zip5 correctly places the first 5 characters of the zip code prior to the '-' in the zip 5 field, HOWEVER, it does not put the last 4 characters following the '-' in the zip 4 field

                            My zip5 correctly places the first 5 and last 4 in the zip5 and zip4 fields, HOWEVER, what I just noticed is that for the zips that have the zip6 data, although the zip is properly placed in the zip6 field, it is ALSO placing the first 5 characters into the zip5 field :(

                            Stan, what do I need to add to your expression so that it also places the last 4 of the zip into the zip4 field?
                            Just leave off the AT("-", ZIP, 1)=0

                            and use

                            if(at(" ",alltrim(ZIP),1)=0,left(ZIP,5),"")
                            There can be only one.

                            Comment


                              #15
                              Re: zip code quandary

                              BINGO!!! You are the man Stan ;)
                              Cheryl
                              #1 Designs By Pagecrazy
                              http://pagecrazy.com/

                              Comment

                              Working...
                              X