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

How to change one number on global update

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

    How to change one number on global update

    I have 1000 invoice numbers I would like to change from 13000 to 14000 in my invoice field. I have not made any changes to this application in about 9 years and have forgotten much. Using alpha4v7. Any help?
    Chuck

    #2
    Re: How to change one number on global update

    Originally posted by [email protected] View Post
    I have 1000 invoice numbers I would like to change from 13000 to 14000 in my invoice field. I have not made any changes to this application in about 9 years and have forgotten much. Using alpha4v7. Any help?
    Chuck
    Chuck,

    >View > Options > Search and Replace > Search for: 13000 >replace with : 14000

    Choose the proper field and go. If you are not sure, make a new database and copy your DB to it to test. Changes are not reversible but this is cut and dry.

    Comment


      #3
      Re: How to change one number on global update

      Originally posted by Dave McClain View Post
      Chuck,

      >View > Options > Search and Replace > Search for: 13000 >replace with : 14000

      Choose the proper field and go. If you are not sure, make a new database and copy your DB to it to test. Changes are not reversible but this is cut and dry.
      Thanks Dave. But I guess I did not explain properly. I want to change all the invoice numbers between 13000-13999 and change them to 14000-14999. If there was a wildcard that could be use in search and replace such as search *3*** and replace *4***, but I think a global update would work, but do not know what script to use.

      Comment


        #4
        Re: How to change one number on global update

        Originally posted by [email protected] View Post
        Thanks Dave. But I guess I did not explain properly. I want to change all the invoice numbers between 13000-13999 and change them to 14000-14999. If there was a wildcard that could be use in search and replace such as search *3*** and replace *4***, but I think a global update would work, but do not know what script to use.
        Chuck,

        OK, I'm not sure but you could still copy to another database and try the "wild card." I have done that but like you, it's been so long ago that I forget.

        Comment


          #5
          Re: How to change one number on global update

          I would use a global update. First search/sort and find the target records ie invoices in the 13000 range.

          Then use global update and add 1000 to each invoice number. If the invoice is a character convert from string to numeric, add 1000 and convert back to string.
          Dave

          Comment


            #6
            Re: How to change one number on global update

            Originally posted by dpawley View Post
            I would use a global update. First search/sort and find the target records ie invoices in the 13000 range.

            Then use global update and add 1000 to each invoice number. If the invoice is a character convert from string to numeric, add 1000 and convert back to string.
            Thanks Dave,
            I tried your suggestion this weekend and I could not get it to work because I have forgotten most functions so I spent most of my time in the alpha 4v6 reference manual. I will keep trying.
            Chuck

            Comment


              #7
              Re: How to change one number on global update

              Chuck,

              I believe your expression in the global update should look something like one of the following:
              The first INVOICENO you would use if the field is a number
              The second would be if it is definded as a character field of length 6 with no decimal(ie the 6,0 at the end of the STR(n,length,decimal)).

              You should only need one of the examples and not both!

              Code:
               
                                        [B]U p d a t e   F i e l d s[/B]
              [U][B]Field        Expression[/B][/U]
               INVOICENO    INVOICENO+1000
               INVOICECHR   STR((VAL(INVOICECHR)+1000),6,0)
              Please make sure you make a backup before performing any global updates incase something goes wrong.

              And if you do not want to apply the update to all records in the table you would want to run a query (search/sor) and select only the records where invoice number is in the target range.
              Dave

              Comment


                #8
                Re: How to change one number on global update

                Originally posted by dpawley View Post
                Chuck,

                I believe your expression in the global update should look something like one of the following:
                The first INVOICENO you would use if the field is a number
                The second would be if it is definded as a character field of length 6 with no decimal(ie the 6,0 at the end of the STR(n,length,decimal)).

                You should only need one of the examples and not both!

                Code:
                 
                                          [B]U p d a t e   F i e l d s[/B]
                [U][B]Field        Expression[/B][/U]
                 INVOICENO    INVOICENO+1000
                 INVOICECHR   STR((VAL(INVOICECHR)+1000),6,0)
                Please make sure you make a backup before performing any global updates incase something goes wrong.

                And if you do not want to apply the update to all records in the table you would want to run a query (search/sor) and select only the records where invoice number is in the target range.
                Hi Dave,
                I hope you are still with me. This is the first time I have had to work on this issue. Here is what I have found out so far. I did a search/sort for invoices 13000-14000 and it was successful. I then did a global update to the search/sort list and ran this expresion
                STR((VAL(INVOICE_NO)+7000),5,0)
                Here is what happened. The invoice numbers were changed to 20000-21000 as they should, except at random the first 2 numbers of the invoice numbers were changed to 27 or 34 or 41, (example 27338, 34339, 41340, 41556, 34660). The last 3 numbers were always correct. I looked at the original invoices and discovered that where this problem occurred there were more than 1 child record in that invoice (parts for that invoice). If there were 2 child records the invoice number became 27000, if there were 3 child records the invoice number became 34000. if there were 4 child records it became 41000 etc. Do you have any idea what is going on. Thank you for your help so far.

                Chuck

                Comment


                  #9
                  Re: How to change one number on global update

                  In my opinion you should just run this against the table you are changing and not a set. Then it should all work perfectly. If the link field is Invoice Number then you could run it twice - once for each table.

                  Explanation:
                  A set is just a virtual representation of the combination of tables. So if you were using tables INVOICE_MASTER and INVOICE_DETAIL and a set INVOICES and INVOICE_MASTER had 2 records and INVOICE_DETAIL had 1 detail record for the first master and 3 detail records for the second, the your set would appear to have four records which is the number of combinations of the master and detail records. So using your update against the set you would change the first record which has one combination of master-detail and the renumbering works. The second record of the set is the first combination of the second master record and the renumbering would work correctly on this record. However, when you continue to the next record in the SET, it is still pointing at the same invoice number field which has already been changed so it would add the 7000 again. The same is true for the third combination which is why you are seeing the progression that you are.

                  If the master/detail files look like this:
                  INVOICE_MASTER
                  13000 CUSTNO1
                  13001 CUSTNO2
                  INVOICE_DETAIL
                  13000 PROD1
                  13001 PROD1
                  13001 PROD2
                  13001 PROD3
                  INVOICES

                  Then the original set would look like this:
                  13000 CUSTNO1 PROD1
                  13001 CUSTNO2 PROD1
                  13001 CUSTNO2 PROD2
                  13001 CUSTNO2 PROD3

                  And after the renumbering update cycles through the first record:
                  20000 CUSTNO1 PROD1
                  13001 CUSTNO2 PROD1
                  13001 CUSTNO2 PROD2
                  13001 CUSTNO2 PROD3

                  And after the renumbering update cycles throught the second record:
                  20000 CUSTNO1 PROD1
                  20001 CUSTNO2 PROD1
                  20001 CUSTNO2 PROD2
                  20001 CUSTNO2 PROD3

                  Now you can see that although the update has not even done its thing on the 3rd and 4th records the Invoice Number has alread updated. That is because the set is a virtual table made up of the actual tables and when we updated the second record of the set it changed the invoice field in the INVOICE_MASTER table which then immediately updated ALL records in the set. So when your update routine goes to its completion it would add another 14000 to the invoice number making the fianl result as 34001.

                  Hopefully you can follow my explanation and see why you should never run updates against a set and only a table.

                  Comment


                    #10
                    Re: How to change one number on global update

                    Doug,
                    Thanks for the insight. That solved the problem. I applied the global update to each table and it worked. Thanks to all for my requests for help. I dont think I could have solved it by myself.
                    Chuck

                    Comment

                    Working...
                    X