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

Add record for browse freezes; updates previous record erroneously

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

    Add record for browse freezes; updates previous record erroneously

    I'm trying to understand some rather weird behavior using the grid control.

    I can add only one new record to a browse, and when I try to add an additional one, the information overwrites the previous record's information.

    My form is exremely simple and contains two objects:
    Code:
    Variable: mTopic_id
    
    Embedded browse displayes these fields:
    Subtopic_No
    Line_Text
    Topic_id
    I want to allow the user to enter the first two fields of information and have the last field populated with the value of the variable. Very simple, very straightforward.

    There are no restrictions at either the form or the browse level.

    The browse has a single event OnSave defined as follows:

    Code:
    Set value property of the objects in which window?
    Current form or browse window
    
    Set value property of the following objects
    Browse1: Topic_Id
    
    How will you specify the value property?
    Specify a variable that contains the value
    
    Variable?
    mTopic_Id
    Screen 1:
    When I enter the form, a line for a new record is displayed.

    Screen 2:
    I enter information into the first field, then tab to the second field enter information.

    Screen 3:
    I tab to the third field and it is automatcally populated by the Action Script with the value of the variable.

    So far, so good.

    But then something weird happens.

    Screen 4:
    Instead of creating another <New record line>, the browse freezes.

    The new record line (*) does not display a blank field for the first field instead is populated with the value of the previous line.

    When I type and overwrite the value of the first field, when I tab to the second field, three weird things happen:

    Screen 6:
    1. The value I just typed in overwrites the PREVIOUS record's value
    2. The tab advances to the second field of the previous record and assumes that I want to overwrite the value there
    3. Amazingly, the <New record> line appears

    When I try to enter a new record, the browse just tabs through the previous records fields.

    I've tried the OnEnter event at the form level and the OnSave at the browse level and still have these problems.

    If I remove the Action Script, the browse behaves correctly.

    Note that the records on this form are not child records, but are from the same table as that of the Parent form which opens this form. Otherwise I probably could use the form.ViewLinked() method.

    Am I doing something wrong or is this a bug?

    Bob McGaffic
    Pittsburgh, PA
    Last edited by rmcgaffic; 03-19-2009, 03:29 PM.

    #2
    Re: Add record for browse freezes; updates previous record erroneously

    Bob, attaching a zipped copy of the database is much better than a series of images. Without being able to easily test your design my first thought is why use the OnSave event for the browse? Why not use the OnEnter event for the form? On Save will fire whenever the user edits and saves an existing record. When those edits occur the variable value may have changed. Your script would overwrite the original Topic_id. Wouldn't that be undesirable?

    Later on...Bob, in testing here I found that my idea of using the OnEnter for the form doesn't work... not sure why. So, I put a button on the form. The button enters a new record in the browse, sets the "text" property of the topic_id column (using the variable value as source), and then "activates" the first column so the user can begin typing... works fine.
    Last edited by Tom Cone Jr; 03-19-2009, 03:59 PM.

    Comment


      #3
      Re: Add record for browse freezes; updates previous record erroneously

      Tom,

      I tried the OnEnter event first and had the same problem. But the OnEnter event is not available to the browse object, that's why I had to resort to the OnSave event. Note that I moved the field that I wanted to populate was physically located at the end of the browse line, so populating is the very last thing done before the record is saved.

      I will zip a small database this evening.

      Bob McGaffic
      Pittsburgh, PA

      Comment


        #4
        Re: Add record for browse freezes; updates previous record erroneously

        Bob, that's the problem. You're misunderstanding when OnSave fires. It fires immediately after the save has occurred. By then it's too late to insert a field value... And you still have the problem with accidental overwrites later on if edits are permitted.

        Comment


          #5
          Re: Add record for browse freezes; updates previous record erroneously

          Tom,

          Ah-hah! [Light bulb goes on].

          Your examples works fine, and I actually had done something very similar yesterday.

          Because this form is simply allowing a user to create a list of items, I had hoped to allow him/her to add items just as quickly as possible without clicking on a [Button] like the one you proposed.

          I was trying to provide the easy convenience of filling an Excel spreadsheet, after hitting enter the cursor automatically moved to the next line ready for entry without a lot of mouse clicks

          For the particular application I am working on, the ability to capture the user's thoughts quickly is critical.

          I had:
          1. Set the Enter restriction property to True
          2. Click on button to execute action script as follows:

          2a. Set Enter restriction to False
          2b. Add record and populate the field Id_num, from your example.
          2c. Set Enter restriction to True

          I very much appreciate the time you took to look at this issue. I know that the approach we both used is a good fall back position, but I will continue to play with it over the weekend, before I give up hope that Alpha is incapable of doing this directly.

          Bob McGaffic
          Pittsburgh, PA
          Last edited by rmcgaffic; 03-19-2009, 06:38 PM.

          Comment


            #6
            Re: Add record for browse freezes; updates previous record erroneously

            Bob, at the risk of being even annoying I write again to caution you against making this something that will fire when a record is being saved. The topic_id field could be too easily overwritten when edits to an existing record are saved. Edits are inevitable. Unless the variable will be constant for the life of the application the danger of frequent data loss is looming large in my imagination. Better to populate the field when the new record begins. Ok, having said this more than once I promise. I won't repeat it again.

            Have you considered a keyboard shortcut tied to the button to make it easy to enter a rapid series of records without having to use the mouse?

            -- tom

            Comment


              #7
              Re: Add record for browse freezes; updates previous record erroneously

              I have found the issue, and it does appear to be a bug.

              The problem is that when a set field value is defined as a
              constant, there is no problem,
              but when set with a variable, the browse freezes.

              The OnSave event does NOT appear to be the problem.

              Screen 1: THIS WORKS -- On Save event is defined as follows:

              Code:
              Set the value of the property of objects in which window?
              Current form or browse window
              
              Set value property of the following objects
              Browse1:Topic_Id
              
              How will you specify the value property?
              Specify the value now
              
              Value: 
              AA2
              When the form is opened, the first record is displayed. Mutliple records are added quickly and easily.

              Screen 2: THIS FAILS -- On Save event is defined as above with one change:

              Code:
              How will you specify the value property?
              Specify a variable that contains a value
              
              Varible:
              mTopic_Id
              When the form is opened, the first record is displayed. The second record is added quickly and easily, but no further records can be added. Pressing the tab key simply moves through the second record's fields.

              The global variable mTopic_Id was populated from a field value passed from another form.

              Late breaking insight: when the variable is not passed from a calling form, the browse works as desired. In other words, when the value is entered directly on the form containing the browse, it works.

              When the value of the variable is passed from another form, the browse fails. Both the calling form and the form containing the browse are based on the same table. I would assume that two forms could look at the same table independently. What am I missing?

              Tom, I agree with your design philosophy, but nonetheless this event should work.

              Bob McGaffic
              Pittsburgh, PA
              Last edited by rmcgaffic; 03-19-2009, 11:01 PM.

              Comment


                #8
                Re: Add record for browse freezes; updates previous record erroneously

                Bob,

                I agree with Tom that the CanSave event is the wrong one for this process. If it appears to work at all I would say that it is due to good luck rather than good management.

                Working with Tom's example I placed some action scripting in one the browse's events. I used the CanSave event rather than the OnSave. That way the variable's value gets placed into the last column before the actual save.

                The first three actions in the script: cancel() (the event), record cancel, and end script; are conditional on either of the first two fields being blank. So if you try to save with data missing the record is canceled. (this not part of the problem. Just an optional extra.)

                The final action that sets the last column's value is conditional on that column being blank. That way a subsequent save will not overwrite it.

                Finally I removed the tab stop from the last column so when you tab out of column two it goes straight to a new record. But still fills in the last column.


                Tom: When you take the time to to risk being annoying the rest of are/should be grateful.
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                  #9
                  Re: Add record for browse freezes; updates previous record erroneously

                  Tim, that works very well. Thanks. (I'm testing with the new browse object, by the way, if that makes any difference). -- tom

                  Comment


                    #10
                    Re: Add record for browse freezes; updates previous record erroneously

                    Tom, no probs.
                    Same on the new browse but the laptop I used was back on version 2055-3258
                    Tim Kiebert
                    Eagle Creek Citrus
                    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                    Comment


                      #11
                      Re: Add record for browse freezes; updates previous record erroneously

                      Tom and Tim,

                      I'm going to be extremely nit-picky here, but I see a user interface limitation with what I was trying to do and your suggestions.

                      I, of course, was trying to use the native <new record> functionality in a browse that simply wasn't behaving correctly as I demonstrated above.
                      You both developed a workable solution with an [Add] button.

                      The only problem is that when I opened the child form, I, as an inexperienced user, am confused.

                      Do I click on the row that says <new record> to add my information?
                      Do I click on the [Add button] instead?
                      Do I click on <new record> then [Add]?
                      Do I click on [Add], then <new record>.

                      The <new record> text can be removed by setting the value of the browse's Restrict Enter property. However, with this accomplished, when you click on the [Add button] nothing happens.

                      The code behind the button might be changed to something like this
                      Set Restrict enter to .F.
                      Allow entry of new record
                      Set Restrict enter to .T.

                      I came to the realization that what I was trying to do might be better handled with child records, so I fundamentally changed my table design but with very good results.

                      What made the difference was Tim's mention of the form.LinkView() functionality.

                      I have documented what I did as a addendum to the post "Populating the child record with parent's ID" originally posted by forum member barry685.

                      Bob McGaffic
                      Pittsburgh

                      Comment

                      Working...
                      X