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

Post embedded brouse to parent form

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

    Post embedded brouse to parent form

    Parent form with embedded brouse of the child database (one to many). After entering a record to the child database I want to have an action that will question if field-Action="Replacement" if yes then Take field-Date and change the parent form field-ReplacedLast to the Child field-Date, if not then don't do anything.
    I'm not sure if I can do this at all because I'm using an embedded brouse. I have tried to do it with variables but I haven't gotten anywhere with that. I only end up with the date in the variable I don't know how to write it to the parent database and save it.
    I hope someone can point me into the write direction.
    Thanks.

    #2
    RE: Post embedded brouse to parent form

    Debbie, remember of course that you have a child table, not a database - took me almost a year to start calling them tables. Looks like you should investigate the record events for your child table. If you have the 2nd edition of Xbasic for everyone, look at Chap. 12, it gives a good example of the CanSave Record event. I think you could do your checking in that event.

    -Barry

    Comment


      #3
      RE: Post embedded brouse to parent form

      also, at the browses "canrowchange" event, you can do something like this:

      t=table.current(2) 'parent is 1, current(2) is the first child
      if t.date1 > parentform:date1.value
      parentform:date1.value=t.date1
      end if

      i'm fairly sure the canrowchange also handles the ondepart event for the browse. in other words, if they change the date1 value and then click back on the parent without changing rows in the browse, the script will fire anyway
      Cole Custom Programming - Terrell, Texas
      972 524 8714
      [email protected]

      ____________________
      "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

      Comment


        #4
        RE: Post embedded brouse to parent form

        Debbie,

        Here's an example for you to play with, tear apart, and modify.

        Unzip it to a separate folder. Do not mix it with your development work.

        Open the Customers2 form. You'll find a simple form based on a two table set, consisting of Customers (the parent) and Transactions (the child). If you enter a new transaction record, and the Trans_Type field is "replacement", then the Trans_Date value from the same child table record is written to the Last_Replaced field in the Customers Table.

        This is not a perfect solution, because you probably don't want the user to be able to change the Last_replaced value in Customers, if they go back and reclassify an earlier transaction, making it "Replacement" when it was originally something else. But perhaps it will give you some ideas about how to approach the problem.

        My solution built on ideas from both Martin and Bill.

        I used the OnSaveRecord event in the Transactions table to do the update to the Customers table.

        I used the OnRowChange event in the Browse1 object on the form to refresh the displayed value of the Last_Replaced field in Customers table.

        Hope this helps.

        -- tom

        Comment


          #5
          RE: Post embedded brouse to parent form

          Martin, I tried this approach and found that it updated the value in the parent record as I stepped through the child table record by record. This happened whether I was going forward or backward through the child table. I think she needs a solution which will trigger the updates only when she is entering a new child record, or possibly when she is changing a child record.

          Comment


            #6
            RE: Post embedded brouse to parent form

            Martin, I'm sorry, let me clarify. I modified your suggestion, so that it did an update to the parent table whenever the transaction type was 'Replacement'. since this is what Debbie was looking for. Since I abandoned your idea of comparing the dates, and updating only if the current transaction date is more recent than the parent table value, I began to have too many updates occurring as I stepped through the table. As written, your approach will not automatically change all parent table records... it will happen whenever the current transaction date is more recent than the value stored in the parent table. -- tom

            Comment


              #7
              RE: Post embedded brouse to parent form

              yes - I see what you mean. I read the question too quickly. I haven't looked at your solution yet, but if I were adding the record to the child table in the browse itself, (which I rarely do,) I think I would go to field rules, and possibly at the cansaverecord event for the child table, I might say

              if is_object(":myform")
              ..t=table.get("childname")
              ..if t.action="Replacement"
              ....if t.datefield > :myform:formdate.value
              ......:myform:formdate.value=t.datefield
              ....end if
              ..end if
              end if
              Cole Custom Programming - Terrell, Texas
              972 524 8714
              [email protected]

              ____________________
              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

              Comment


                #8
                RE: Post embedded brouse to parent form

                Tom - I like your idea. However, if you test for the for the entry being made in that form, then you can use that child on another form, for some other reason, and the rule will not fire. Also you don't have to open a second instance of the parent. Since the change to the parent is made as a form:field.value - the current state of the parent is irrelevant (mode=0,1,2) and the form is immediately refreshed. Don't be afraid of addressing specific forms in the rules.

                said the student to his mentor, smiling.
                Cole Custom Programming - Terrell, Texas
                972 524 8714
                [email protected]

                ____________________
                "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                Comment


                  #9
                  RE: Post embedded brouse to parent form

                  Martin, I see what you mean, and will study it more closely this weekend. You're writing changes to the table through the form. I'm writing changes to the table beneath the form. Do you suppose it's a hang over from my DOS coding days, where all changes *had* to be written to the table, and there was no such thing as a form? As I climb on to the psychologist's couch and make myself comfortable, I begin to wonder if, deep down, I don't truly trust Windows' form level objects?
                  (Or maybe it's just a plain old fashioned hangover, that's influencing my thinking this AM?)

                  -- tom

                  Comment


                    #10
                    RE: Post embedded brouse to parent form

                    Well, I'm just glad, that after 2 1/2 years of you mentoring me, at least 333 times, I may have caught you once.

                    As you know, I came straight from 6.22 to A5 and windows - whew, what a transition! I have gradually used more and more of Alpha's features, each time scared of them.

                    A little distrust can be a good thing!

                    So far, I have not found anything that doesn't work in Alpha, once I learned it - with one very irritating exception: (DLL's) certain printer drivers, and perhaps video drivers, can cause Alpha to crash. Because I have my app on 11 computers, besides my own, it can be very frustrating. But, as luck would have it, the "computer from hell" is at a branch office only about 4 blocks from my house. So I go over there late at night, and work on it till it works on that computer. So far, if it works on that computer, it will work on any computer.

                    Anyway - thank's for all your help.
                    Cole Custom Programming - Terrell, Texas
                    972 524 8714
                    [email protected]

                    ____________________
                    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                    Comment

                    Working...
                    X