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

Update child records

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

  • Update child records

    I have an order system that was created in Alpha 5 version4. I have the below coding on the 'on depart' button of the ship date field in an order entry screen. I am trying to update the child record's status field. The problem is that it only does the read and update of the first record and does not read any of the other child records. Can any one see what I am doing wrong and why this worked OK with previous versions of Alpha?
    Thanks - here is the code:

    tbl=table.current()
    if cdate(tbl.ship_date)"""".and.tbl.order_status="ENTERED"
    tbl.order_status="SHIPPED"
    parent.commit()
    lines=table.get("order_lines")
    lines.fetch_first()
    while .not. lines.fetch_eof()

    lines.change_begin()
    if lines.line_status ="ENTERED"
    lines.line_status = "SHIPPED"
    end if
    lines.change_end()
    lines.fetch_next()
    end while
    sys_send_keys("{F5}")
    end if

  • #2
    RE: Update child records

    Mary,

    Shouldn't

    lines.change_end()

    be

    lines.change_end(.t.)

    ???

    -- t

    Comment


    • #3
      RE: Update child records

      You are right Tom. I put that in but it still only updates the first record. I tried the system in Alpha 5 V5 and it works perfectly. This seems so simple!

      Comment


      • #4
        RE: Update child records

        If I do not do the change begin and change end it does scroll through all the child records. It only stops when I have the change code in there. Hope this helps for anyone trying to give me an answer.

        Comment


        • #5
          RE: Update child records

          Just guessing here Mary but instead of:
          ===================
          lines.change_begin()
          if lines.line_status ="ENTERED"
          lines.line_status = "SHIPPED"
          end if
          lines.change_end()
          lines.fetch_next()
          ====================
          try

          ====================
          if lines.line_status ="ENTERED" then
          lines.change_begin()
          lines.line_status = "SHIPPED"
          lines.change_end(.T.)
          end if
          lines.fetch_next()
          ====================

          I don't know if the "then" will help or the reordering but it's worth a try.

          Finian
          Finian

          Comment


          • #6
            RE: Update child records

            Mary,

            My personal preference would be to substitute

            lines = table.current(2) 'assumes child table is in slot 2

            for

            lines=table.get("order_lines")

            in order to get a valid pointer to the child table.

            -- tom

            Comment


            • #7
              RE: Update child records

              I tried your suggestion Finian and had the same results. Thanks for trying to help.

              Comment


              • #8
                RE: Update child records

                Tom:
                DId your table.current(2) with same results. I am thinking of moving the data out of my order lines table and trying this with new records. Maybe something is corrupted in the table. Of course everything is the same when I try it in version 5, but maybe version 6 is less forgiving.

                Comment


                • #9
                  RE: Update child records

                  Mary,

                  OnDepart event will fire each time focus leaves the field, whether the primary table is in enter, view, or change mode. I'd probably put something like this in the OnChange for the field, or, even better, in the OnSave for the form. In pseudo code for the OnSave.

                  And, if you haven't used debug(1) to see where the script is failing now would be a good time.

                  -- tom

                  Comment


                  • #10
                    RE: Update child records

                    Thanks Tom and Finian. I found out the problem. The Order set was somehow bad (I guess). I got this from my client and who knows what happened on his system. I recreated the order line table and copied in the records. I receated a new Order set and everything works fine. It is amazing how version 5 did not have a problem with it and version 6 did. I am sure I will never know why, but it does boether me how somethings work Ok in version 5 and not in version 6. Thansk again.

                    Comment


                    • #11
                      RE: Update child records

                      Mary:
                      I beleieve there is a simple solution to your question and a bit of a complicated explantation, but instead of table.get() use table.open(), if it works, I will explain my theory, if it doesn't then my theory is flawed and not worth discussing! Hope it works.
                      Gabe

                      Comment


                      • #12
                        RE: Update child records

                        Gabe - The files were fixed but I decided to do your table.open() and see what happens. It does work with table.open() and table.get() works also. Can you tell why 'open' is better than 'get'? I use table.get() alot so if I should be using table.open() instead, that will make my frustation with this bad set I had worth all the tearing of my hair out today.

                        Comment


                        • #13
                          RE: Update child records

                          Mary:
                          Before you go bald, here is my theory:
                          In your xbasic, you used "IF"
                          This creates a "query on the fly"
                          In a5v6, alpha saves tose querries
                          when you used table.get(), it opens the same table but it shows it according to the last index or filter which will not reveal all the records.
                          On the other hand, table.open() will open a second instance of the table and will not be affected by that filter.
                          This is just my theory, I do not know how valid it is.
                          Gabe

                          Comment

                          Working...
                          X