MAS 9.2 series cookbook
It is the third recipe on the same work order page, after a field and a dialog. We ran every step on our test system, on the MAS 9.2 series, and the complete page is at the end as a download. Dialogs and Lookups explains the elements.
What you need#
- The page from the first recipe, or any page with a datasource that holds one record.
- The object structure that holds the choices. For locations it is
mxapioperloc.
Step 1 · Add the attribute to the record’s schema#
The work order has to carry the attribute the user will change. As in the first recipe, that is one line in the schema of the page’s datasource:
<attribute name="location" id="fs_k_lookup_a_loc"/>Step 2 · Add a datasource for the choices#
<maximo-datasource id="fs_k_lookup_locs" object-structure="mxapioperloc"
where="siteid="BEDFORD"" order-by="location"
lookup-data="true" page-size="20" selection-mode="single">
<schema id="fs_k_lookup_locs_s">
<attribute name="location" unique-id="true" searchable="true" title="Location" id="fs_k_lookup_l_loc"/>
<attribute name="description" searchable="true" title="Description" id="fs_k_lookup_l_desc"/>
</schema>
</maximo-datasource>| Attribute | What it does here |
|---|---|
lookup-data="true" | the datasource loads when the lookup opens. Before that we counted no request for it |
selection-mode="single" | the user picks one row |
searchable="true" | the attributes the search of the lookup looks into |
where | only the locations of one site |
Step 3 · Add the lookup#
A lookup is a dialog with a datasource, and it sits in the <dialogs> of the page:
<dialogs id="fs_k_lookup_dialogs">
<lookup id="fs_k_lookup_dlg" datasource="fs_k_lookup_locs" lookup-heading="Pick a location"
lookup-attributes="{['location','description']}" show-search="true" show-count="true"/>
</dialogs>lookup-attributes names what each row shows. show-search and show-count add the search box and the count of records.
Step 4 · Turn the field into an input with the lookup#
<smart-input id="fs_k_lookup_si" label="Location" value="{fs_k_lookup_wo.item.location}"
enable-lookup-buttongroup="true" select-lookup-attribute="location" lookup="fs_k_lookup_dlg"/>Three attributes do the work. lookup names the lookup of Step 3. enable-lookup-buttongroup draws the button with the magnifying glass beside the input. select-lookup-attribute names the attribute of the picked row that goes into the value.

Step 5 · Build and try it#
yarn clean && yarn build:mobile
We read each request of this path in the browser:
| Moment | Request to mxapioperloc |
|---|---|
| the page opens | none |
| the lookup opens | one, with oslc.where=siteid="BEDFORD" and oslc.select=location,description. The lookup showed 427 records |
| a search for “boiler” | one, with oslc.searchTerms=boiler and searchAttributes=location,description. It took 229 milliseconds and left 5 records |
The search runs on the server, over the two attributes the schema marks as searchable. So the search covers all 427 locations, whatever the lookup has loaded. One detail differs from the page: the request asked for a page size of 40, where the datasource says 20.
After the pick, the input and the record held BR300. The server still held BR200. A lookup changes the record in the app, and a save sends it, as in the dialog recipe.
What we left out#
We first wrote the page with a lookup-map on the attribute, with two returns: the location, and the description into a local attribute. The location arrived, and the local attribute stayed empty in our run. Without any lookup-map the pick filled the location just the same. So this recipe keeps to the one attribute and to select-lookup-attribute.
The same places in an IBM app#
In an app you duplicated from IBM, lookups sit in the <dialogs> of their page or at app level. The Technician app of the 9.2 series marks 25 of its datasources with lookup-data="true", like ours. A large table such as assets wants a where or a saved query that narrows it. BEDFORD has 427 locations and more than 31,000 assets on our system.
Download#
The files of this recipe: the page we start from and the page with the lookup field.
This recipe as a PDF, to print or to read offline.
What to read next#
Forms and Input Fields covers smart-input with its other kinds, and Dialogs and Lookups covers selection modes and headings of a lookup.
IBM documents the elements of this recipe in the product itself. In the Application Configuration application, open the ? menu and choose Component Documentation for lookup, smart-input and maximo-datasource.
