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

form.load()..... adding extra record

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

    form.load()..... adding extra record

    I can't seem to figure out what is going on here. Have a form based on a set. Child table is displayed in embedded browse. Have a button to call a form to add record to child table. When I add the first related child record, it always adds an extra blank record, if I'm refreshing the browse on return from the Add (see below explanation). 2nd and subsequent additions don't.
    A sample app is attached and here are the instructions.
    1. Open form gpa_worksheet
    2. Run this form. In embedded browse in lower right corner (Plan) where it lists months of the year, click on any of the Edit buttons to open up the problem form (gpa_numbers_edit).
    3. In gpa_numbers_edit form, click on the Add button to bring up the form, gpa_numbers_add.
    4. Enter a record using the drop lists and any values you want then press the Save/Close button to save and close the form.
    5. Depending on if I have my code, on return from the add do anything to refresh the browse to get an accurate display, it will add an extra record. The below code doesn't, but on return, the browse isn't displaying correctly until the row is clicked on.
    Code:
    '''code on Add button
    dim t as p
    dim frm as p
    t = table.get("gpa_details")
    
    frm = form.load("gpa_numbers_add","Dialog")
    frm.New_Record()
    frm:gpadtls_id.value = t.gpadtls_id
    frm:gpaccts_id.value = t.gpaccts_id
    frm:type_acct.value = t.type_acct
    frm:gpa_id.value = t.gpa_id
    frm.Show()
    
    frm.Close()
    'browse1.Activate()
    'browse1.Resynch()
    'parentform.Refresh_Layout()
    parentform.Resynch()
    Now this is weird....when I click on the row to get the proper display, an extra record hasn't been entered. (I've got the gpa_numbers.dbf open) As soon as I close the gpa_numbers_edit form, it adds the extra record to the gpa_numbers.dbf table.
    IF somebody has the time, I sure would appreciate the extra eyes. It must be my code somewhere that is causing this.
    Ernie

    #2
    Re: form.load()..... adding extra record

    Hi Ernie,

    Consider using Form.ViewLinked(), which you can get more info here. And here.
    Last edited by Keith Hubert; 04-14-2009, 03:01 PM.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: form.load()..... adding extra record

      Ernie, does this only happen when the GPA_Numbers table is empty?

      Later on ...Notice that when the gpa_numbers_edit form is opened from the button in the browse, the form is in change mode. You've assigned field values to objects in the form. Nothing in the Add button commits those changes to disk before the gpa_numbers_add form is loaded and new record is begun there. I'm curious if the problem goes away if you change the ADD button script to commit pending changes in the "edit" form, before the script loads the "Add" form ?

      Still later ...One last thought. Your "events" button in the browse on the "edits" form mixes code that directly manipulates the tables (using pointers) with other code that indirectly manipulates tables through the GUI of a form. I think that's a bad practice. I recommend you do all the work using table pointers, or do all the work "talking" to the underlying tables through the objects that are displayed in the form. Choose one or the other. Don't mix them.

      -- tom
      Last edited by Tom Cone Jr; 04-14-2009, 02:44 PM.

      Comment


        #4
        Re: form.load()..... adding extra record

        Keith,
        I'll have a look to see if it makes a difference. Have used it before, but haven't tried it here.

        Tom,
        Thanks for the suggestions. Yes, I've put a topparent.commit() before the add code is called and it doesn't make any difference. For some reason, a browse1.Activate() is what seems to be adding the extra record????? Have another form I use if user wants to add records to selected months. (See attachments) Have the same code on the Add button there and do not need to refresh browse. It works perfect. I just do the form.load() (modeless), load the variables then show the form. The added record appears correctly in the browse and no extra records get added.
        The reason I use the dialog type form in this one is to do the refresh of the browse after returning to get the display correct. However, no refresh will actually get the browse to display the just added record, if it's the first child record. Have to add a browse1.activate() which adds the extra record. Have tried refresh_layout(), refresh(), resynch() (with this on the browse, you have to activate() the browse first), etc.
        Thanks again for your help.
        Ernie

        Comment


          #5
          Re: form.load()..... adding extra record

          Ernie, it is beginning to sound like the browse is beginning a new record when you are NOT expecting it, and then it gets saved when focus leaves the browse. If there are no rows displayed when the browse gets focus it will automatically go into ENTER mode. If you then shift focus away (without canceling first) then the browse will save the record, right? This doesn't happen if there is at least one row displayed already, because that row gets focus and the browse doesn't go into ENTER mode. Does this make sense? Preventing the browse from beginning a new record automatically is going to be the solution you need. What if you remove the tab stop for the browse object and what if you make it read only? Or maybe you need to CANCEL if the mode of the form is ENTER. Might either or both of these solve your problem?

          Comment


            #6
            Re: form.load()..... adding extra record

            Tom,
            I placed code (on the form Close button) to capture the browse1.mode_get().

            1. On first entry, with browse empty, it is in "Enter" mode. No record is added on closing.
            2. On first entry, with one or more rows filled in browse, mode = "Change". No record is added on closing.
            3. After returning from add, with new record added, mode = "View". An extra record is added on closing.

            Is this a valid test?
            Ernie

            Comment


              #7
              Re: form.load()..... adding extra record

              Ernie, it's hard to say from here.... but it seems to support what I was thinking. Review the sequence that populates fields in the "edits" form as it's being opened. Study the tab sequence. Figure out why focus is shifting into the browse and then block it.

              At the same time, you might try this using a "month" that has no records displayed in the "edits" form browse. Hit the ESC key to cancel the pending new record, immediately before clicking the Add button. Do you still get an unwanted record upon return from the "add" form?

              Comment


                #8
                Re: form.load()..... adding extra record

                Well, as usual Tom, you were right. The browse was in enter mode on entering if no child browse records. I really don't understand why. There are records in the table. What I did was copy the other form (the attachment from a couple of posts back) that is the exact same, but with an added embedded browse of the parent table. It was in view mode on opening. So I just deleted that browse and now it all works as "expected". Again, I have no earthly idea why??????
                Well, another day blown chasing rats.
                Thanks for your help.
                Ernie

                Comment


                  #9
                  Re: form.load()..... adding extra record

                  Ernie, didn't your "events" event script in the first form open the "edits" form with a filter? that filter is what was emptying the browse for months that had no matching records. Any time focus shifts into a browse object that is "empty" Alpha assumes the user wants to enter a new record. Makes sense, right? The fact that the child table contains other records (none of which match the specified filter) is irrelevant. The browse is "empty" so a new record begins. Simple as that.

                  Comment


                    #10
                    Re: form.load()..... adding extra record

                    Tom, I sort of understand that. However, I am using the exact same call from the first browse event_events, but into the copied form I indicated. I just deleted the parent table browse from it. Now it opens with the same query as before, but the browse is in view mode instead of Enter mode. That is what I don't understand. Both forms are based on the same set, but one has a parent table browse with parent table fields beside it plus the child browse below. The other has the parent table fields with the child browse below. Now for some reason when this form opens with no child related records, the browse is in view mode instead of enter mode. Both browses are set up the exact same with Restrict Enter and no Tab Stop.
                    Thanks for trying to clear the cobwebs.
                    Ernie

                    Comment

                    Working...
                    X