11 Replies Latest reply on Feb 14, 2013 11:47 AM by user17265

    Force commit when changing database

    user17265

      Is there a way to force a commit to the currently active layout when a user changes to a layout in a different database? This used to happen automatically in v6. We need a trigger when a layout loses focus, but that doesn't seem to exist.

       

      We recently upgrades from v6 to v12 and still have dozens of different database files, and users are often switching between them, leaving records open, preventing access by anyone else. The layout on the original users screen is now out of view, so we often have to page people to close their hidden records.

        • 1. Re: Force commit when changing database
          Vaughan

          When you say "user changes to a layout in a different database" what do you mean? They open a new window? They navigate in the same window?

          • 2. Re: Force commit when changing database
            BruceRobertson

            Pretty sure he means neither of the above. Every window represents a different file.

            • 3. Re: Force commit when changing database
              user17265

              Bruce,

               

              Thanks, I did mean a different file.  I posted a reply to Vaughn to that affect, but don’t see it in fmdev thread.  Am I supposed to Reply to my original post?

               

               

               

              David

              • 4. Re: Force commit when changing database
                user17265

                Vaughn,

                 

                Thanks, yes, as Bruce guessed the layouts are in different database files.  I posted the same reply to your question in the fmdev forum, but I don’t see it in the thread.

                 

                 

                 

                David

                • 5. Re: Force commit when changing database
                  Vaughan

                  I don't think you can do much to "force" record commit. In fact often you don't want record commit when changing windows.

                   

                  What you CAN do it put a TO of the other file into the current file, and copy the layout. That way navigating to the "other" file is actually remaining in the same file.

                   

                  Do this and eventually you'll have an interface file with separate data files. You can then start moving the tables into a single data file, or move the data into the interface so they aren't "separated" any more.

                  • 6. Re: Force commit when changing database
                    breezer

                    If you have a navigation script, you can add the following script step just before navigating to the other files layout:

                     

                    Commit Records/Request[]

                     

                    Otherwise add it to the scripted button that calls to navigate to the file. If the buttons use a single script step such as "Go To layout..." you may need to change it to call a script instead, eg:

                     

                    Commit record/Request[]

                    Open File ["OtherFile"]

                    Go to layout ["OtherFileLayout"]

                    Select Window[]

                    • 7. Re: Force commit when changing database
                      Mike_Mitchell

                      Vaughan's solution is probably best.

                       

                      You could cobble together a script in every database that checks to see if windows for any of the other databases are open and run a "commit" script in each of them if they are (triggered, say, OnRecordLoad or OnObjectEnter). But that's rife with issues. I would probably not want to do it, because it would seriously detract from user experience. (Imagine all the flickering as the interface switched between windows every time the user did anything. Yikes!)

                       

                      Mike

                      • 8. Re: Force commit when changing database
                        user17265

                        Thanks for all the suggestions, but with over 60 separate files, I’m not sure I want to tackle any of them, even though there are probably only a handful that cause problems.  We had no problem when V6 forced commits when changing databases, so I’m not sure why Vaughan suggests that is not a good idea.   Wouldn’t the problem of blocking other users from changing a record still exist if all the layouts were in the same file?  We would still have people opening a record, then obscuring it with another layout and forgetting they had left that first record open.  What I really need is ‘Layout Lost Focus’ trigger. 

                         

                         

                         

                        Until then, to force commits, we’re going to encourage people to leave their layouts in Find mode after making any changes, since that is the first thing they are going to do the next time they come back to that layout anyway.  My boss is still cursing Apple for changing the Enter key into a second option key, adding a hurdle to making commits.  Now we have to use KeyReMap to make the right side option key back into an Enter key.

                        • 9. Re: Force commit when changing database
                          DavidJondreau

                          You could use an Install OnTimerScript script step on a layoutLoad trigger. It would cycle through every 2 minutes or so and try a Commit[]. It will be a little annoying since it's possible it will step on users toes occassionally committing when they're in the middle of data entry. But it may be less annoying than the current situation.

                           

                          David

                          1 of 1 people found this helpful
                          • 10. Re: Force commit when changing database
                            user17265

                            Sounds good.  I was going to try a variation; start the timer in the OnRecordLoad event, and disable it in OnRecordCommit, to reduce unnecessary overhead, but someone would then resume editing after a commit and the timer would not be running.  I could restart the timer every time there is activity, but stopping and restarting the timer with each OnLayoutKeystroke seemed like overkill.  But I tried it, and I could not detect any lag when typing in a field as fast as I could, so I’ll see how that works.

                            • 11. Re: Force commit when changing database
                              user17265

                              In case anyone else is following this thread, I’ve discovered a drawback to using OnTimerScript.  It is not supported by Server side scripts, so any server script that loads a layout that runs OnTimerScript will fail, and it might to take a while to figure out why.