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

Multiple Updates to the Same Field

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

    Multiple Updates to the Same Field

    I can write an Operation that updates a Field. I need to update this one field to about 12 different values based on other fields in the db. Is there a way to write all these updates into one (1) Operation? Or is there a way to run 12 operations with one command? I have tried updated the same field in two different ways in a single Operation but only the first update works - the second is ignored.

    Thanks - Chuck B

    #2
    Re: Multiple Updates to the Same Field

    The field value to be written to the field can be defined using an expression. The CASE() function might be a way to arrange for the expression to return 12 different values based on 12 different conditions. This would result in a single saved update operation and eliminate the need to run multiple update operations.

    Comment


      #3
      Re: Multiple Updates to the Same Field

      Originally posted by cgbjr View Post
      I have tried updated the same field in two different ways in a single Operation but only the first update works - the second is ignored.
      I would expect that if you examine the results, both updates worked but the second overwrote the first. When you define an update operation, you can specify

      the field to be updated
      the expression to use for the update
      the condition under which to perform the update

      You could have

      field---------expression-----condition
      fielda--------upper(fieldb)---left(fieldc,1) = "B"
      fielda--------upper(fieldd)---left(fieldc,1) = "D"
      fielda--------upper(fielde)---left(fieldc,1) = "E"
      fielda--------upper(fieldf)---left(fieldc,1) = "F"
      'many more combinations
      fielda--------upper(fieldz)---left(fieldc,1) = "Z"

      If you don't specify conditions, as indicated, the fielda above would first be updated with upper(fieldb), then upper(fieldc), etc with the result in fielda of upper(fieldz)
      There can be only one.

      Comment


        #4
        Re: Multiple Updates to the Same Field

        I need to update this one field to about 12 different values based on other fields in the db
        I am not sure what this means?!
        In the end, the field will have ONE and ONLY ONE value, the last value used for updating that field. What's keeping you from getting there the first time around?
        You need to explain this a little bit better.

        Comment


          #5
          Re: Multiple Updates to the Same Field

          G Gabriel - I'm doing a conversion from an old DOS db to Alpha. I'm creating two new fields based on one old field that has about 20 different values spread over 10,000 records. So, I need to run a series of expressions and hoped to do it with one operation that, line by line, assigned about a dozen new values.

          Stan - I went back and tried again and I guess I had some bad logic in the original second line, because it works now. I don't think one expression was overwriting another, just that one expression wasn't working at all. There was no error message, but I still think there was an error. So, I am able to run a series of changes to the same field in one operation. Huzzah!

          Comment


            #6
            Re: Multiple Updates to the Same Field

            QUESTION RELATING TO UPDATING FIELD VALUES?

            Assume I have a table named "DY_STYLES"

            It is linked by "style number" to another table called "BOM"

            The BOM table contains components or parts that make up various styles. A component can be, and often is, in many different styles.

            In this BOM a particular component is named "2662p-ss" and has the following fields which need to be changed.


            "source" char 4
            "gram_wgt" num 7 4
            "cost" num 6 2


            On occasion, any one or all of these fields, may need to be changed.

            A typical change might be: source from city to onty
            gram wgt " 3.450 to 3.453
            cost " 4.50 to 5.50

            "City" may be the original or current supplier. "Onty" may make the piece also but gives quicker delivery, so we want to switch sources. However, Onty's casting, in this case,
            is slightly different in gram weight and cost.

            Since this component exists in thirty or forty different styles. we need to change
            gram weight and cost also for every place this component exists in the BOM.

            A procedural example of how to accomplish this would be much appreciated.

            Hope someone notices this and can point me in the right direction..

            Thanks in advance,
            John Linley

            Comment


              #7
              Re: Multiple Updates to the Same Field

              A copule of points that might help. You can only update the parent table of a set if you want to use values from one or more children. You didn't specify which of the tables was the parent.

              You can conditionally update selelcted parent records if you can define an expression which returns a logical result. To simplify, you can define an update operation which takes the desired values from DY_STYLES and places them in the desired fields in BOM with the condition ------ component = "2662p-ss". That's not very useful since you would have to change the operation each time you wanted to change another component.

              You have to decide how to write the condition expression that works for you.

              You might consider having some sort of form based on a set with BOM as the parent and DY_STYLES as the child. The fields from DY_STYLES would be in an embedded browse on the form. Double clicking on a row in the browse could be coded to take the values in that row and place them in the desired fields in the parent table.
              There can be only one.

              Comment


                #8
                Re: Multiple Updates to the Same Field

                Originally posted by Stan Mathews View Post
                A copule of points that might help. You can only update the parent table of a set if you want to use values from one or more children. You didn't specify which of the tables was the parent.

                You can conditionally update selelcted parent records if you can define an expression which returns a logical result. To simplify, you can define an update operation which takes the desired values from DY_STYLES and places them in the desired fields in BOM with the condition ------ component = "2662p-ss". That's not very useful since you would have to change the operation each time you wanted to change another component.

                You have to decide how to write the condition expression that works for you.

                You might consider having some sort of form based on a set with BOM as the parent and DY_STYLES as the child. The fields from DY_STYLES would be in an embedded browse on the form. Double clicking on a row in the browse could be coded to take the values in that row and place them in the desired fields in the parent table.

                Comment


                  #9
                  Re: Multiple Updates to the Same Field

                  Stan: Thanks again for trying to help. Hopefully, this time, I will attempt to provide better information. First: "DY STYLES" is the parent and "BOM" is the child.
                  The link between them is "STYLE NBR".

                  A component number such as "2662P-SS" exists only in the BOM, but will exist for each style that uses that component. Some components may exist in as many as 60 different styles.

                  As stated earlier, for practical reasons, we may need to update a component.

                  I have been able to global update values in a single field elsewhere using ask variables. I suppose I could do this again.

                  I have not had, before this, needed or wanted to globally multiple fields simultaneously in the same table.

                  Since I haven't ventured down this particular road before, I solicited assistance.

                  I did make a stab at it, by creating a button on a form of the BOM that called up a checklist dialog box, with the 3 fields to be updated on it. At this point I became very uncertain as to executing the next step.

                  I hope this second explanation of my needs is sufficient and updating three fields in one pass is a possibility. It would certainly be more efficient and look more professional.


                  Kindest regards,

                  John

                  Comment


                    #10
                    Re: Multiple Updates to the Same Field

                    John,
                    Sounds like a many-to-many setup.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Multiple Updates to the Same Field

                      MIKE W:

                      In response to your comment, "dy_styles" is linked to "BOM" as a one to many link.
                      There are approximately 700 styles in the DY_styles" table , and approximately 3000 records ( or parts) in the BOM table.
                      The link between the two is the style #, a 26 character field.

                      Individual components, eg: ."01carat diamond" may exist in three hundred different styles, from every quantity to one to 136 Other components may exist in only a dozen or so styles.

                      Basically, I asked for help in globally updating more than one field in the table "BOM" for a particular component such as "2662p-ss" in one step instead of multiple steps.

                      Thanks for responding, and I hope this further explanation satisfactorily explains.

                      I haven't surrendered either...
                      Regards, John L.

                      Comment


                        #12
                        Re: Multiple Updates to the Same Field

                        John,
                        A Dy_style record is linked to many BOM components. Each BOM component is linked to many dy_styles. This generates a Many-to-many relationship. To view all the BOM records linked to the style, the style table is the parent. To view all the styles linked to a given component, the BOM table is the parent. To view both at the same time, I believe you need an intermediate table. I believe I have an example somewhere I'll try and find.

                        How do you have yours set up? How you have that set up will make a difference on how you perform this action.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: Multiple Updates to the Same Field

                          TO: MIKE W:
                          Mike, My set structure, {DY_STYLES to BOM} is defined as a "one-to-many" link.
                          The linking field is the style number.
                          No other structure links these two tables together. I am at a loss to understand
                          how there could be a "many-to-many" link by components! There are no component values in the parent table "dy_styles".

                          Each style of jewelry has quantities of components ranging from about 4 components to a dozen components consisting of diamonds; metal(castings);, precious and semi-precious stones.

                          There is a separate table "LABOR: also linked to this set. Items of labor are: setting, jewelry, polishing, etc.
                          The actual structure of the set "bill of material", is: "dy_styles" linked to table "BOM" one-to-many" and also linked to "labor" one-to-many.


                          Since the set link, by style number is one to many, where does the other link many to many come from? I have only been in Alpha5 for a little over a year, and am aware of some of the differences to alpha4 but certainly not all.
                          I also don't understand how this affects wanting to edit field/s in just the table "BOM"!

                          I sincerely appreciate your interest,

                          Regards,
                          John L
                          Last edited by john linley; 01-30-2009, 12:02 PM. Reason: pushed the wrong button!!!

                          Comment


                            #14
                            Re: Multiple Updates to the Same Field

                            John,
                            I have an example for you. Pardon me that I used DOM instead of BOM (my mistake). I will send it but it will take some explanation that I don't have time right now to generate. I will send the example and you can look at it. The component change button on the form will change the values of a chosen component in the entire DOM table. You will see this in the Upper DOM browse, not the lower. There is a way though proper relational table and set structure to be able to make the change in one component table value and that will relate through the application. That is the second (lower) DOM browse on the form.

                            I will get back with you later if you need mor explanation.
                            Last edited by Mike Wilson; 01-30-2009, 05:27 PM.
                            Mike W
                            __________________________
                            "I rebel in at least small things to express to the world that I have not completely surrendered"

                            Comment


                              #15
                              Re: Multiple Updates to the Same Field

                              Mike

                              Received your zip and have copied it to a5 in an adb called m2m.
                              I have already taken a quick look at the set structure and find it interesting. I will need more time to study this at length.
                              Thanks very much for the assistance, and I will definitely report back to you sometime this coming week.

                              My sincerest appreciation,

                              John L

                              Comment

                              Working...
                              X