Basic Features

The inputs to an extended formula can be fields or queries. This section begins by describing the properties of an extended formula using a field as an input.

For additional features available when using a query as an input, see the Query section.

Note:

All Date, DateTime, and Time fields are stored in the system in milliseconds. When a formula declaration calls for time in milliseconds, you can use a Date, a DateTime, or a Time field as input.

The extended formula engine takes the default path in an expression, if the value of a Date or DateTime field in the expression is not set. Use HasValue() to determine if a value is set or verify that a Date or DateTime field has a value in the database if it is used in an expression. Make sure that the field has a default value.

Maximo® Real Estate and Facilities does not allow supplying an extended formula for a field until after the field is saved for the first time. In the Data Modeler, after a field has been saved for the first time, you can edit the field’s properties to add an extended formula. Make sure that the Formula check box is checked and then select the Extended radio button for the Formula Type.

The examples in this section use a Number field for illustration. The same process applies to other field types that contain a Formula check box.

At this point the Field Properties form should look like the following, with an Enter link below the Extended radio button in the Formula Type property.

(a) Field Properties

  • Section: General
  • Field Type: Number
  • Name: cstPerimeterNU
  • Label: Perimeter
  • Description: _____
  • Purpose: _____
  • Required: []
  • Do not Auto Populate: []
  • Result Column: []
  • Mobile Field: []
  • Staging Table Field: []
  • Staging Table Key: []
  • Read Only: [x]
  • Default Value: _____
  • UOM List: Area
  • Default UOM: square-feet
  • Validation: Accept Decimal
  • Use Custom UOM Precision and Mask: []
  • UOM Source Attribute
  • Threshold Source Attribute
  • Formula: [x]
  • Sum this Field: []
  • Formula Type: Extended [Enter]

To create or edit an extended formula, click the Enter link in the Formula Type property. Clicking the Enter link causes a form for specifying the details of an extended formula to appear in the Data Modeler’s List panel.

The Extended Formula form is divided into three sections.

  • The Inputs section specifies the fields or queries from which the formula will get values.
  • The Outputs section identifies where the formula’s result will go.
  • The Formula section contains the text of the actual formula.

We will explain how to create formulas using fields as inputs by working through some examples. The first example will be an extended formula to compute the perimeter of a rectangle.

The formula has two inputs, which are the value of fields named Height and Width. Starting from a blank Extended Formula form, to add an input, click the Add action on the Inputs section bar. This adds a blank input to the Inputs section.

The Inputs section has a blank input containing the following:

  • A radio button to select to if you want to delete the input.
  • An empty text field. This is discussed in detail below.
  • A drop-down list that has the default value Field. The input in this example comes from a field, so do not change the value.
  • A Select hyperlink. This is used to select the field that will be the source of the input value, as discussed below.

Click the Select hyperlink. The Pick Element form pops up that allows selecting a field.

The Pick Element form shows a tree for choosing a field. The elements in the tree are ordered alphabetically. Sections on this field’s business object appear first, followed by sections in other business objects associated to this field’s business object. The tree can be dragged and resized within the Extended Formula form. Click the plus icon to expand the view. Click the minus icon to close the view. A dot icon indicates a field.

Use the formula tree to select the Height field (e.g., cstHeightNU under the RecordInformation parent) as the first input by clicking its name in the formula tree. After you select the Height field, the Pick Element form disappears. The Extended Formula form now shows a hyperlink in the input.

The hyperlink in the input shows the section and name of the field selected (e.g., RecordInformation:cstHeightNU).

If you had selected a field in a different business object, the hyperlink’s text would have included the names of all associations used to get to the other business object. The hyperlink’s text tells how to find the field selected. It can be long, awkward, and error prone to enter manually. For this reason, the hyperlink’s text is not used to identify the field in the formula. Instead, the Inputs text box supplies a shorter name.

Type the name h into the text field. This allows us to use the name for this input in the formula section.

Repeat these steps to add the Width field as a second input with the name w. The Extended Formula form now shows the following:

  • Input h for RecordInformation:cstHeightNU
  • Input w for RecordInformation:cstWidthNU

The Outputs section identifies the field that will receive the value of the extended formula. The format is data section:field name. In this example, the Outputs section (e.g., Record Information:Perimeter) does not need to be changed. This is normal.

The extended formula is created with the field it belongs to as one of its outputs. Usually, a formula has no other outputs. If you want the result of the formula to be put in more than one field, you can specify this by adding the other fields that should receive the formula’s result to the extended formula’s Outputs section. If you add any outputs to an extended formula, you will be allowed to delete the outputs later on. However, you cannot delete the original field that the extended formula belongs to from its Outputs section.

Since no other inputs are needed by the example formula, we are ready to put the formula to be calculated in the Extended Formula form’s Formula section. Enter the formula as h*w*2.

The Extended Formula form now shows the following:

  • Input h and Input Type Field for RecordInformation:cstHeightNU
  • Input w and Input Type Field for RecordInformation:cstWidthNU
  • Output of Record Information:Perimeter
  • Formula of (h+w)*2

You have finished specifying the extended formula, so click the Ok action at the top of the form. It is important to click the Ok action. If you do not, the extended formula is not saved and you lose it. You also need to click Save Field on the section bar at the top of the Data Modeler.

An extended formula can have any number of inputs. The following example shows an extended formula with four inputs.

  • Input h and Input Type Field for RecordInformation:cstHeightNU
  • Input w and Input Type Field for RecordInformation:cstWidthNU
  • Input l and Input Type Field for RecordInformation:cstLengthNU
  • Input t and Input Type Field for RecordInformation:cstThicknessNU
  • Output of Record Information:SampleCalc1
  • Formula of (h-t-2)*(w-t-2)*(l-t-2)

The Formula in an extended formula can contain the four arithmetic operators:

  • + - Addition
  • - - Subtraction
  • * - Multiplication
  • / - Division

The Formula of an extended formula also can contain parentheses to con­trol the order in which the operations are performed. Multiplication and division are normally performed before addition and subtraction. This means that the value of 1+2*4 is 9. The multiplication is done first; 2*4 is 8. The addition is done next; 1+8 is 9.

If you want the addition to be done first, use parentheses. The value of (1+2)*4 is 12. Because of the parentheses, the addition is done first; 1+2 is 3. The multiplication is done next; 3*4 is 12.

In addition to the arithmetic operators, there are other operations available as predefined formulas that you can use in the Formula text box. The example below shows an extended formula that uses a predefined formula named sqrt.

  • Input w and Input Type Field for RecordInformation:cstWidthNU
  • Input l and Input Type Field for RecordInformation:cstLengthNU
  • Output of Record Information:SampleCalc1
  • Formula of sqrt(w*w+l*l)

There are other predefined formulas provided by Maximo Real Estate and Facilities. To see a list of available predefined formulas, click the look-up-icon icon to the right of the Formula text box. This causes a form containing a list of the available predefined formulas to pop up.

Some predefined formulas have inputs that are string or text values. The text values can come from fields of records or be the value in the formula. To put a string value directly in a formula, enclose it in double or single quotes like "THIS" or 'THAT'.

If you need a text value that contains a single quote, enclose it in double quotes like this: "O'Clock"

If you need a text value that contains a double quote, enclose it in single quotes like this: 'He said, "Boo."'

You cannot directly put a text value that contains both single and double quotes in a formula. However, you can concatenate to combine two or more text values into a single text value. To put the value It is at "four o'clock" in a formula you could write it as '"four ' + "o'clock" + '"'

The list of predefined formulas has two sections. The upper section shows a list of the formulas that have been predefined by people. The lower section shows formulas that have been predefined by the platform. Formulas predefined by people are described in Predefining Your Own Formulas. Formulas predefined by the platform are described in Formulas Predefined by the Platform.

Query

When the value of an input is to be the result of a query, first define the query in the Report Manager. For more information, see Reporting in Maximo Real Estate and Facilities. Once the query exists, it can be used in an extended formula. To do so, in the Inputs section select Query from the Input Type drop-down box and click the Select hyperlink to identify the query.