Alpha Software Blog

Handling Write Conflicts Server-Side in Offline-Enabled Mobile Apps

Alpha Anywhere's built-in support for offline access makes it easy to build mobile applications that work anywhere - with or without a network connection. Users can continue to work without fear of losing data when their network connection is lost. Work can be saved back to the system of record when a device acquires a network connection through a process called "synchronization".

Offline Synchronization

Synchronization is a two-fold process. While the user was working offline, changes may have been made by other users to the records of interest. New information is downloaded from the server while local changes made on the device are uploaded and saved. It is possible that the same record has been modified in both locations - on the device and in the database. This can create "write conflicts". When a write conflict occurs, the conflicting changes need to be resolved before the synchronization process can be completed.

The out-of-the-box behavior in offline-enabled apps prompts the user to decide what should happen when write conflicts occur. The user is prompted to tap on fields with write conflicts and choose a conflict resolution action. Users can choose one of two options when resolving a write conflict: "Use mine" or "Use theirs". Choosing "Use mine" will save the changes from the mobile device to the database, overwriting the value in the system of record. "Use theirs" discards the change in the mobile app, leaving the data in the database unchanged. When all write conflicts are resolved, synchronization can be completed.

Handling Write Conflicts in Offline Mobile Apps for Users

In some situations, it may be desirable to handle write conflicts programmatically instead of allowing users to decide what should happen. Alpha Anywhere provides server-side events that you can utilize to add your own custom write conflict handling, allowing you to decide which value to keep. You could also choose to use neither value, entering your own custom values to be saved.

Handling write conflicts programmatically is done server-side via xbasic. An xbasic function can be called when the server-side "On write conflict" is triggered for the List control. The xbasic function can specify how write conflicts should be handled for all records or on a case-by-case basis.

To learn more, watch the videos below:

Options for Handling Write Conflicts when Syncing Data Part 1
Options for Handling Write Conflicts when Syncing Data Part 2

Learn how Alpha Anywhere can help you Build Offline Apps from the Very Best

We recently announced the agenda for this year's Alpha DevCon. Alpha DevCon 2016 is going to be bigger than ever, including two presentation tracks geared towards technical and non-technical users. Presentations will revolve around building disconnected mobile applications and the ease with which citizen developers have succeeded with Alpha Anywhere. Learn what's in store for the future of Alpha Anywhere and network with Alpha Anywhere developers from around the world. There will be several awards presentations, including the winners of our Alpha DevCon Most Innovative App Contest, and a Hackathon wherein participants will be challenged to build an Alpha Anywhere application in 30 minutes.

We're running a special offer this week: register for Alpha Devcon by Friday, July 30th and save $550. Click here for more information: //

Want to participate in the Alpha DevCon Contest? Visit our Contest page to submit your application and you may win a year's subscription to Alpha Anywhere, an Apple Watch, or an Andriod Tablet. The deadline to submit your application is August 31, 2016.
Technical Sessions Announced for Alpha DevCon 2016
Top Reasons Alpha DevCon is Different this Year

About Author

Sarah Mitchell
Sarah Mitchell

Technical Writer and Documentation Expert at Alpha Software

Related Posts
New Webinar: How to Integrate ChatGPT with Alpha Anywhere
New Webinar: How to Integrate ChatGPT with Alpha Anywhere
Best Data Collection Software For Manufacturing [2023]: A 101 Guide
Best Data Collection Software For Manufacturing [2023]: A 101 Guide
Quickly Build High Performing Apps with New JSONForm in Alpha Anywhere
Quickly Build High Performing Apps with New JSONForm in Alpha Anywhere

The Alpha platform is the only unified mobile and web app development and deployment environment with distinct “no-code” and “low-code” components. Using the Alpha TransForm no-code product, business users and developers can take full advantage of all the capabilities of the smartphone to turn any form into a mobile app in minutes, and power users can add advanced app functionality with Alpha TransForm's built-in programming language. IT developers can use the Alpha Anywhere low-code environment to develop complex web or mobile business apps from scratch, integrate data with existing systems of record and workflows (including data collected via Alpha TransForm), and add additional security or authentication requirements to protect corporate data.