Skip to content
Part 3 of 12

Saved as You Type: Automatic Saves, and Nothing Lost When the Session Ends

Building an inspection form is long work, and a MAS session can end in the middle of it. mas-tools.com Inspection Form Editor saves every change by itself, shows the time of the last save, names an item that Manage would refuse, and keeps unsaved changes in the browser until the next sign-in. This article explains how, and where the limits are.

A folk painting in two panels: on the left a scribe writes on a long paper strip by a lit oil lamp while three birds carry small strips to a shelved cabinet; on the right the desk is empty, the lamp is out, and a bird sits on an open painted chest that holds two strips

Building an inspection form is long work. An administrator types forty questions, sets the choices, adds the rules, and checks the result. Somewhere in that hour, the MAS session can end: the idle timeout runs out during a phone call, a sign-out in another tab ends it, or an administrator ends it for maintenance.

In IBM’s Inspection Forms application, a dialog ends with Cancel and Save, and the page ends with Done. A delete of a question or a group asks once and says that it cannot be undone.

mas-tools.com Inspection Form Editor takes another approach to the same work. It has no Save button. Each change goes to Manage by itself, as you. An item that Manage would refuse waits, and the bar names it. Changes that are not saved yet stay in the browser when the session ends, and they are saved after the next sign-in. This article explains each of these steps, and where the limits are. We checked the behaviour on our test system, on the MAS 9.2 series.

No Save button, and the time of the last save

The first time a user opens a form, a blue line under the bar says it plainly: “Changes are saved automatically. The time of the last save is always shown in the bar above.” Got it closes the line.

The editor with an empty form: the outline on the left, the form in the middle, the preview on the right, and a blue line that says changes are saved automatically.

A new form opens as a Draft, revision 1, with the line about automatic saves.

From then on, a save starts a short moment after the last change. The bar shows “Saving…” while it runs, and then the time of the server’s answer, such as “Saved 16:03:37”. That time is the last save that this browser made of the form, and it is still there when the form opens again later.

The editor with question 1.3 Safety valve lifts at working pressure open and two rules under its choices: if the answer is Fail then show and require 1.4, and the same for 1.5.

The bar shows the time of the last save, here right after the second rule was added.

Each save goes to Manage as the signed-in user, through the object structure MXAPIINSPFORM. Manage records the user as the one who changed the form, and Manage checks the user’s options on every request, as it does for IBM’s application.

What the automatic save may touch

An automatic save is safe only when it cannot change what inspectors use. So the editor saves the content of a form only in a Draft and in a Pending revision. An Active, Inactive or Revised revision opens read-only, with one line under the bar that says why. One field of an Active revision is the exception: its reason. A user with the options REVISION and SAVE can give or change it in the Form tab, and nothing else of the revision changes. A change to an Active form starts with Create revision, and the new Pending revision is edited and saved like a Draft. Inspectors keep the Active revision until the new one is activated, which stays an explicit step with its own dialog.

A save sends the difference since the last save. On our test system, Manage stored such a request as a whole or not at all: a request with one invalid part stored nothing. A rule on a field that is new in the same save needs a second request, because the rule needs the field’s number from Manage. If that second request fails, the revision stays valid without the rule, and the next save sends the rule again.

An unfinished item waits, and the bar names it

Manage refuses some items that are still being written, such as a question without text. A form is full of such moments: the administrator adds a question, and the text comes a few seconds later.

The editor holds such an item back and saves everything else. The bar says which item waits. A question waits for its text, a section for its title, a choice for its text. A formula that Manage would refuse waits until it is fixed. As soon as the item is complete, it is saved.

The editor with a new, empty choice on question 2.4 and the Check tab on the right, which names the error and a waiting save.

The bar: “Saved 16:03:56. A choice of question 2.4 waits for its text. Everything else is saved.”

In the picture, the administrator has added a fifth choice to question 2.4 and has not typed it yet. The bar says exactly that. The Check tab names the same item as an error, and the outline marks the question.

Two actions wait for the save as well, because both work on what Manage holds. The activation waits until the work is saved, since Manage activates the revision as it holds it. The export to a file waits too, since the file holds what Manage holds. Each says so in its own line. The activation goes on by itself when the save is done, and the export has to be started again.

Undo and redo in the form

Every change in the form is a step that can be undone. Undo and Redo sit in the bar, and Ctrl+Z and Ctrl+Shift+Z work on the canvas. A delete of a section takes its questions along, and one undo brings all of them back. The undo is saved like any other change.

Stored attachments are the exception. Add a file… stores a file in Manage at once, and Remove removes a stored attachment from Manage at once, because Manage deletes a file together with its last link. Both are requests of their own, outside the undo steps. So Remove asks first, and Undo does not bring the file back.

When the session ends

Every change is kept in the browser at the moment it is made, before the save starts. The editor writes it to the browser’s own storage, under the user and the form revision. That is the rule behind the design: no way out of the session loses a change.

A flow: a change is kept in the browser at once; a short moment later it is saved to Manage as the user, and the bar shows the time; an item Manage would refuse waits and is named; when the session has ended, the change stays kept, and after the next sign-in it is saved when the form opensA flow: a change is kept in the browser at once; a short moment later it is saved to Manage as the user, and the bar shows the time; an item Manage would refuse waits and is named; when the session has ended, the change stays kept, and after the next sign-in it is saved when the form opens
The way of one change, also when the session ends

The editor also acts before the session ends where it can. When you sign out, when the idle warning counts down, and when an administrator’s forced logout shows its minutes, the editor first saves what is pending and waits for Manage’s answer for a few seconds. The idle warning and the forced logout dialog both say how many changes are not saved yet.

When a save meets a session that has already ended, the bar says “Signed out. Your changes are kept.” Sign in again goes through the MAS login and back to the same form. There the kept changes are applied and saved. The same happens after a closed tab: the next time the form opens, the kept changes are saved. Until then, the list of forms marks the form with the number of changes kept in this browser.

Kept changes belong to their user. When another user signs in on the same browser, those changes are never shown to that user, and never saved under that user’s name.

When the form has changed in the meantime

A colleague can change the same revision while your changes wait. Each save carries Manage’s row stamps of what it changes, and Manage refuses a save on a stale stamp. The editor then reads the form again, applies your changes to the new state, and saves them. A change that no longer fits is named: “Another user changed this form. 1 of your changes no longer fits and was left out: …”. So you read the list and make that change again where it still applies.

A colleague can also activate the revision while your changes wait. Kept changes for a revision that is Active by now are named in the bar and stay out of it.

A save that fails for another reason says what Manage answered, keeps every change, and tries again a few seconds later.

The form stays a Manage form

All of this happens in the editor. What reaches Manage is a normal inspection form, saved in the same object structure that IBM’s application uses. IBM’s application opens it, and the inspection app of Maximo Mobile reads the same records from Manage.

What comes next

The user guide’s first form shows the blue line and the saves on a form built from nothing. A Pending revision, its reason and its activation are in the guide’s revisions section. The previous article explains the rules of a form. The mas-tools.com Inspection Form Editor page lists the whole series.

Want to see the editor keep a form through a sign-out? Get in touch.

IBM and Maximo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide.

← Back to mas-tools.com Inspection Form Editor

See the tools on your own data.

Ask us for a price, a trial licence or a demo. We work in English and German.