Record Locking and Editing Shared Data
Panorama only allows one user to edit each record at a time. Once you begin editing, the record remains locked until you either move to another record, switch to another window, or save the database. The best way to understand record locking is to see it in action. We’ll follow along as “Bob Blue” and “Rudy Red” both edit a Real Estate Listings database. As we follow along, we’ll use one of these icons with each screenshot to identify which computer we are looking at, Bob’s or Rudy’s.

Bob starts by opening the Real Estate Listings database. The radio wave icon in the toolbar shows that the database is connected to the server. The server will coordinate database changes between Bob and his colleagues.

Bob gets a phone call that there is an offer of $675,000 on the Geneva Street house! So he opens the listings database and double clicks to enter the new offer.

As soon as Bob double clicks, Panorama locks the record so that no one else can make changes while Bob is editing. Bob goes ahead and enters the offer price into the data cell.

At the same time, Rudy is checking his e-mail and receives a message that Tim Tobin is not the Agent on the 632 Geneva Street house, it should be Mary Jackson. So he opens the listing database and double clicks on the agent name.

But when Rudy double clicks, Panorama doesn’t let him edit the agent name. Instead, it tells him that this record is already being edited by Bob.

Back on Bob’s computer, Bob has pressed the Return key to finish entering the new asking price, but he still hasn’t moved to another record.

As long as Bob remain’s on this record, it remains locked, so if Rudy tries again to edit the Agent name he finds that it is still locked.

Now Bob moves on to a different record. As soon as Bob leaves the 623 Geneva Street record, Panorama unlocks it so that Bob’s colleagues can have their turn.

Now that the 623 Geneva Street record is unlocked, Rudy can edit it. So when Rudy tries again to double click on the Agent name, he succeeds this time. Now the record is locked again, this time by Rudy.

Notice that the new $675,000 offer that Bob entered now appears in Rudy’s copy of the database. Whenever you begin editing a record Panorama not only locks that record, it also updates the local copy of the record with the latest data from the server.

Rudy completes his modification by typing in the new agent name (Mary Jackson) and then moving to another record to unlock the record he just modified.

At this point, the record is unlocked, and the server contains the changes made by both Bob and Rudy. However, Bob can’t yet see the change Rudy made to the agent name. The change will appear if Bob edits this record again, or if Bob chooses Synchronize Data from the File menu. Here’s what Bob’s screen looks like after he synchronizes.

To learn more about synchronization see Shared Database Synchronization.

### Record Lock Timeout

When you edit a record, Panorama normally keeps it locked until you do one of three things—move to another record in the same database, bring a different database to the front, or save the database. But what if someone starts editing a record and then gets distracted? Perhaps they get a phone call, or leave for lunch. Meanwhile no one else can edit that record.

Fortunately this can be resolved by enabling Panorama’s record lock timeout. You may recall that when we made the Real Estate Listing database sharable we set this timeout to 45 seconds.

Let’s revisit the record locking example from the previous section. Suppose Bob starts editing the record and then is interrupted and walks away from his computer.

After 15 seconds, nothing has changed.

Still no change after 30 seconds.

After 45 seconds, however, Panorama automatically completes Bob’s editing and unlocks the record.

Now Rudy (or anyone else) can edit this record.

#### Changing the Record Lock Timeout

To change the timeout value, start with the database you want to change on top. Then open the Database Options dialog from the File menu, and switch to the Server panel.

Change the auto unlock timeout to the desired setting and press the Ok button.

When editing, the timer is reset every time you hit a key or click the mouse. So setting this value to 20 means that the record will automatically unlock if you don’t hit a key or click the mouse for 20 seconds.

Note: When the timeout is modified after the database has already been changed to a sharable database, the change applies only to the current computer. You must repeat it on the other computers on the network if you want them to use the same settings. (Conversely, this allows you to use different timeouts on different computers.)

Auto Unlock on the Server – In addition to the client side auto-unlock described above, you can also configure the server to automatically unlock a record if the connection between the client and the server is broken for more than a specified length of time. This is set up in the Preferences>Server panel, under advanced options. To learn more, see Auto Lock Timeout on the Advanced Server Settings page.

#### Manually Locking/Unlocking a Record

As explained above, Panorama will automatically lock the current record when you double click to edit a cell in the record, and it will automatically unlock when you move to a different record in the database. You can also lock and unlock the current record manually.

To lock the current record, choose Lock Record from the Record menu. Once locked, no one else can edit the record until you are finished, or until the timeout limit is exceeded. Of course if someone else is already editing the record, the Lock Record command will be denied.

Once the record is locked, the Record menu’s Lock Record command becomes the Unlock Record command. Choose this if you are finished editing the record but don’t want to move to another record. Your changes will be uploaded to the server, and then the record lock is removed so that your colleagues will have the opportunity to modify this record.

#### Manually Downloading a Record

If you haven’t edited a record for a while, and haven’t synchronized, the record may be out-of-date since other users may have changed it. You can synchronize to refresh the entire database, but if you’re just interested in the current record you can refresh that by choosing the Download Record from Server command from the Records menu (this item is only available when the database is connected to the server). This downloads the most recent changes to this record to your local computer. (Note that this download also happens automatically when you lock and edit the record. The Download Record from Server command, however, does not lock the record, so you can use this command to view the latest changes without tying up the record and preventing other users from editing it.)

If you have already locked the record and started making changes to it, the Download Record from Server command will destroy those changes and replace them with the data on the server. Before actually destroying the changes, Panorama will ask you to confirm that this is really what you want.

If you do confirm this, the changes are replaced with the downloaded data, and the record is unlocked.

#### Manually Uploading a Record

A shared database is normally modified by locking a record, making changes, then unlocking the record. When the record is unlocked the changes are uploaded to the server and saved there, then eventually synchronized to all the other users.

It normally should be impossible to make changes to the local database without locking the record. But if you somehow manage to do this, you can manually upload those changes to the server copy of the database by holding down the Option key and choosing Upload Record from the Records database. However, this should be considered an emergency measure. If someone else was editing the record, using the Upload Record command will bypass record locking, and your changes will override the other users changes. This is why this command is hidden and can only be accessed by pressing the Option key. Use this command only with extreme care.

See Also

- Advanced Server Settings -- Panorama X Server settings for advanced users.
- Automatic Record Numbering in a Shared Database -- generating unique numbers across multiple users.
- Shared Database Synchronization -- data synchronization across multiple users.
- Working With Summary Records in a Shared Database -- summary records are not shared between users.

History

Version | Status | Notes
10.2 | New | New in this version.