Skip to content
Part 2 of 12

Rules You Can Read: Conditions and Validations in Maximo Inspection Forms

A rule makes an inspection form react: a Fail shows a follow-up question, a number out of range is rejected. In IBM's Inspection Forms application, rules live in a dialog away from the form. This article shows how mas-tools.com Inspection Form Editor writes a condition and a validation as a sentence under its field, lists every rule in one tab, and proves each rule in the preview.

Embroidery on linen: a column of six stitched cards with rows of teal, dark and orange satin stitch; two orange threads run from a knot on the third card to knots on the two dashed cards below; a cross-stitched card holds a scale with two marks; a smaller copy of the column stands on the right, and a needle with orange thread lies below

Rules make an inspection form react. The inspector answers Fail, and a question for the remarks appears and must be answered. A reading of 48 litres comes in for a tank that holds 40, and the inspection app rejects it with a message. Manage stores both kinds, the condition and the validation, in one table, INSPCASCADEOPTION, and the inspection app evaluates them in a clear order.

Building them in IBM’s Inspection Forms application is the hard part. The rules live in a dialog that opens from the revision list, away from the form itself. For a condition on a choice, the dialog offers the answer, the target, Required and Visible. A message for the inspector is set on the choice itself, as its feedback text and “require action”. The answer and the target of a saved rule cannot be changed: you delete the rule and build it again. The preview is a separate page, and an answer there fires no rule, so a field that a rule shows stays hidden. The first person who sees a rule fire is often the inspector.

This article shows how mas-tools.com Inspection Form Editor handles the same rules. A rule stands where it acts, under its field, as one sentence. One tab lists every rule of the form. The preview shows the rule at work before the form goes live. We checked the behaviour on our test system, on the MAS 9.2 series.

What a rule does

A rule reads the answer of one field, its source. When the answer matches, the rule acts.

A flow from the inspector's answer to the question whether it matches a choice, a value of a domain or a number range; on a match the rule shows, requires or hides another field, or shows a message; a validation rejects an answer that does not match; without a match the other field keeps its own settingsA flow from the inspector's answer to the question whether it matches a choice, a value of a domain or a number range; on a match the rule shows, requires or hides another field, or shows a message; a validation rejects an answer that does not match; without a match the other field keeps its own settings
A rule reads its source field and acts when the answer matches

The source is one of three kinds of field. On a choice field (Single choice, Multiple choice), the rule matches one choice. On a domain field (Single choice domain, Multiple choice domain) and on a characteristic meter, it matches one value of the domain, and the editor offers the values of your system. On a number field (Single numeric entry, Formula calculation, the other Meter readings), it matches a comparison such as > 5, and a second comparison can join it with “and”.

The rule then does one of four things. It shows another field, shows it and makes it required, hides it, or shows a message to the inspector. A message can also require an action. A validation is the fifth kind, and it works the other way round, as a later section explains.

A rule on a number can also do several of these at once. Beside the field it acts on, it has a box for a message and the box require an action. The sentence names every part, such as “if the answer is > 10: show the message “Replace the pads”, require an action, and show and require 2 Photo of the worn pad”. With the message box left empty, the rule requires an action without a message on the screen. On a choice or on a value of a domain, a rule does one of the four things.

A rule is one sentence under its field

Open a question with a choice field, and + rule sits under its choices. The editor writes the new rule as one sentence. It takes the last choice and the next field, so in a typical Pass and Fail question the first rule is right as it stands.

Question 2.2 Crank bearing with the choices Good, Worn and Loose in green, orange and red, and two rules: if the answer is Worn then show 2.3, and if the answer is Loose then show and require 2.3.

Two rules on one field: Worn shows question 2.3, Loose shows and requires it.

Each part of the sentence is a box: the choice, the effect, and the field it acts on. Each box can be changed at any time, also on a rule that is saved. Manage accepts a change of a stored rule in place, and the editor writes it that way, so a correction is one click in the right box.

The other end of the rule is visible too. A closed question shows its rules in short form, such as “↳ if Fail: show and require 1.4 …”. The question that the rule acts on shows “↰ shown and required by 1.3 = Fail”, and a click on that line opens the source. In the outline, ⇢ marks a source and ⇠ marks a target.

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.

Question 1.3 holds two rules, and questions 1.4 and 1.5 below it say which rule shows them.

A validation names the valid answer

A number field has a second button, + validation. A validation reads as “reject unless >= 0 and <= 40 with the message …”. The condition names what a valid answer meets. The inspection app rejects every answer outside that range and shows the message. A field takes one validation.

That wording is deliberate. An administrator thinks of the limits of a tank or a gauge, and the sentence states them as they are: from 0 to 40 litres. The rejection follows from the range.

Every rule of the form in one tab

The Rules tab in the side panel lists every rule of the form. Each rule is one sentence, grouped under the question it reads, and a click on the question opens it on the canvas.

The editor with the Rules tab open on the right: every rule of the form, grouped by the question it reads.

The Rules tab lists every rule of the form in one place.

The beam engine form in the picture has six rules. Questions 1.1 and 1.2 carry a validation each, with the limits of the oil reservoir. Question 1.3 computes the oil used and shows a message above 5 litres. Question 2.1 shows a message above 60 °C. Question 2.2 carries the two rules of the crank bearing. A reviewer reads the whole logic of the form in this one list, without opening a single question.

Hidden until a rule shows it

A rule that shows a field only makes sense when the field starts hidden. So each field has the box Hidden until a rule shows it. The form check watches both sides. A field that starts hidden and that no rule shows is a warning, because an inspector would never see it. A rule that shows a field that is always visible offers the link make the target hidden until shown.

The editor with question 1.5 Photo of the safety valve open: a file upload field, hidden until a rule shows it, with the document folder Photos.

Question 1.5 starts hidden. Until a rule shows it, the form check warns about it.

Rules also depend on the text of a choice, because Manage matches a choice by its text. So when the text of a choice changes, its rules have to change with it. The editor links each rule to its choice, and a rename rewrites the text of the rule in the same save. A deleted choice leaves its rule in place: the editor names the lost choice, and the form check reports it as an error. The error blocks the activation until the administrator fixes the rule or removes it.

When several rules act on one field

Two rules can name the same target, as Worn and Loose do for question 2.3 above. The inspection app then decides in a fixed order: required wins over not required, then visible wins over hidden, then the later rule wins. A rule of a hidden field does nothing, so rules can work in a chain. The editor’s preview follows the same order.

The preview proves the rule

The Preview tab is a reproduction of the mobile app, and it answers like the app. A choice or a value of a domain can be picked, and a number typed. A rule shows and hides fields, a message appears under its field, and a validation rejects a number outside its range. On a domain field and on a characteristic meter, the preview offers the values of the domain and fires the rule when you pick its value.

The preview of the mobile app: question 1.3 answered Fail, and questions 1.4 Remarks on the safety valve and 1.5 Photo of the safety valve shown below it, both marked as required.

In the preview, Fail on question 1.3 shows questions 1.4 and 1.5.

In the picture, the answer Fail on question 1.3 has shown questions 1.4 and 1.5, and both are required now. Pass hides them again. The preview stores no answer in Manage, and Reset answers clears it. So the administrator tries every rule of a Draft before an inspector meets it, and fixes it on the canvas beside the preview.

The rules stay Manage’s rules

The editor writes each rule as a normal row of the form in Manage, through the object structure MXAPIINSPFORM, as the signed-in user. IBM’s application shows these rules in the dialog that opens from the revision list, and the inspection app of Maximo Mobile reads the same records from Manage. Nothing in the form depends on the editor.

What comes next

The next article is about saving: every change goes to Manage as you type, and nothing is lost when the session ends. The steps for a rule and a validation are in the user guide’s rules section, and the first form builds the safety valve rules of this article step by step. The previous article explains the editor’s window. The mas-tools.com Inspection Form Editor page lists the whole series.

Want to see the rules of one of your forms as sentences? 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.