MAS 9.2 series overview
We ran every measurement on our test system, on the MAS 9.2 series, with IBM’s demo data. The order is our own judgment. We put first the beliefs that nothing in a normal working day contradicts, because those are the ones that reach production.
Each section has the same four parts: the belief, what we measured, a check for your own system, and the model that holds.
1 · “An empty list means the query found nothing”#
The belief: In Maximo, an empty result set has one meaning: no record matches.
What we measured: We put two lists on one page. The datasource of the first one asked for a work order number that does not exist. The datasource of the second one was held back by a can-load condition and never sent a request. Both lists read “No results found”. On screen they are the same.
The state of the datasource tells them apart:
hasData | Rows | |
|---|---|---|
| never loaded | false | 0 |
| loaded, nothing found | true | 0 |
A datasource that no component reads also stays silent, and so does one that waits behind a condition. In both cases the query can be perfect.
Check it yourself: Put a label next to the list and bind it to the state of the datasource, with label="{myDatasource.state.hasData}", and open the page.
The model that holds: An empty list has more than one possible reason. Nothing matches, or nothing was asked. Find out which one before you change the query. Loading and Displaying Data has all six cases.
2 · “If my code fails, somebody will see an error”#
The belief: An exception in Maximo ends in a message box. A broken script is hard to miss.
What we measured: We wrote a page whose pageResumed hook throws an error on every visit, and we opened it. The page drew with all its texts, and nothing on screen showed a problem. The framework had caught the error and written one line to the browser console:
[ERROR]: [FSCOMPM]: [JS-Controllable]: [fs_ctl_throw]: Controller event pageResumed failed
on controller instance: FsCtlController. Controller events should not throw errors.The part of the hook after the error never ran. For the user, the page looked complete and behaved as if half of its code were missing.
Check it yourself: Add throw new Error('test') as the first line of a pageResumed method. Open the page and then the console, and search for “Controller event”.
The model that holds: A hook that can fail needs its own try and catch, and a message the user can see. Using Lifecycle Hooks Correctly shows the pattern.
3 · “A wrong attribute name gives an error”#
The belief: Every part of a query is checked. A name that does not exist is refused.
What we measured: We sent the same request four times, each time with one wrong name in a different place:
| The wrong name is in | Answer |
|---|---|
oslc.select | HTTP 200, the record, the unknown name left out |
oslc.where | HTTP 400, BMXAA8781E |
oslc.orderBy | HTTP 400, BMXAA9105E |
| the object structure | HTTP 404, BMXAA4216E |
Three of the four places refuse the name. The select list accepts it in silence. This request returned the same record as the request without notanattribute:
oslc.select=wonum,notanattribute
oslc.where=wonum="1221" and siteid="BEDFORD"The select list is the one that matters most in an app. The schema of a datasource becomes this list. A misspelled attribute in a schema passes the build, and Maximo answers 200. The field on the page then shows a striped bar that looks like a value still on its way.
Check it yourself: Send one request with a misspelled attribute in oslc.select and compare the answer with the correct request. A REST client or the address bar of a browser with a Maximo session is enough.
The model that holds: A typing mistake in a where clause is reported. A typing mistake in a select list looks like missing data. Selecting Data with oslc.select covers the server side, and the cookbook recipe Add a Field shows the striped bar and how our MAF editor marks the mistake before the build.
4 · “What works in the browser preview works on the device”#
The belief: A development server is production with less traffic.
What we measured: We started IBM’s Technician app in the local preview and read the console. The framework said this at the start:
[ WARN]: [JS-PlatformFactory]: Mobile platform was targeted but this application
is being run from %s. Changing to a browser platform.The app was built for the mobile platform, and the preview replaced that platform with one for the browser. The bridge to the native container was absent as well: typeof window.maximomobile gave "undefined". So the parts that live in the native container are out of reach in the preview: the local database, the transaction queue and the sync. Every datasource of the preview asks Maximo directly.
The second difference is the user. The preview reads its data with the API key of the developer. In our preview, the list “Assigned work” of the Technician app read “No results found”. For the demo technician, the same app showed an assigned work order.
Check it yourself: Open the console of your preview and type typeof window.maximomobile. Then search the console for “browser platform”.
The model that holds: The preview tests the pages and the logic of the controllers, with online data and with your rights. Offline behaviour, sync and the rights of a real technician need a device or an emulator, and a real user.
5 · “The user variable works in every where clause”#
The belief: Maximo replaces &USERNAME& and &SYSDAY& in a where clause, so both work in the where of a datasource.
What we measured: The where attribute of a datasource travels as oslc.where. We counted work orders of one site with four clauses. 158 work orders carry the name of our user in changeby:
| Clause | Rows |
|---|---|
changeby="…" with the user name typed out | 158 |
changeby="&USERNAME&" | 0 |
changeby="&PERSONID&" | 0 |
changeby="-userid-" | 158 |
The user variable matched no row, and Maximo reported no error. The date variable is different. reportdate>="&SYSDAY&-40D" returned 156 work orders, the same number as a clause with the date of forty days ago typed out. So one of the two familiar variables works, and the other one fails in silence.
Check it yourself: Count the records with your own user name as a literal, and count again with "&USERNAME&" in its place.
The model that holds: For the user, oslc.where has its own values: "-userid-", "-personid-" and "-laborcode-". The oslc.where Clause lists them. A where clause that needs more belongs in a saved query of the object structure.
6 · “The framework waits for my async hook”#
The belief: pageInitialized runs first. When it has finished, pageResumed runs.
What we measured: We gave a page a pageInitialized hook that takes 1.5 seconds and then sets a state. The trace of that page:
page.pageInitialized(fs_ctl_async)
page.pageResumed(fs_ctl_async)
page.pageInitialized(fs_ctl_async) finishedpageResumed ran while pageInitialized was still at work. The page was on screen before either of them had finished.
Check it yourself: Put await new Promise((r) => setTimeout(r, 1500)) and then a console.log into an async pageInitialized. Put a second console.log into pageResumed. Read the order in the console.
The model that holds: The framework calls a hook and goes on. When a later hook needs the result of an earlier one, keep the promise in the controller and wait for it yourself. The same guide, Using Lifecycle Hooks Correctly, has the code.
7 · “A click runs one method”#
The belief: A button names a handler, and the handler lives in the controller of the page.
What we measured: We wrote a method with the same name on three controllers: the controller of a datasource, the controller of the page and the controller of the application. One click on one button gave three lines in our trace:
ds.ctlBoth
page.ctlBoth
app.ctlBothA click runs on every controller that has a method of that name, in a fixed order. The same holds for the hooks of a datasource: onAfterLoadData reached the datasource controller, then the page controller, then the application controller.
Check it yourself: Write a method with one name on your page controller and on your application controller, with a console.log in each. Press a button with that name in on-click.
The model that holds: A method name is a call to every controller on the path. That is useful: a handler on the application controller serves the buttons of all pages. It is also a trap for two methods that share a name by accident. The Controller Architecture Overview has the full path.
8 · “load() reads the data again”#
The belief: A call named load goes to the server.
What we measured: We called load() on a datasource that had its rows already and counted the requests:
| Call on a loaded datasource | Requests |
|---|---|
load() | 0 |
loadIfNecessary() | 0 |
load({noCache: true}) | 1 |
forceReload() | 1 |
A plain load() returned the rows the datasource held. A change that another user made in Maximo stayed invisible.
Check it yourself: Open the network tab of the browser. Call load() on a loaded datasource from a button and watch for a request.
The model that holds: load() means “make sure there are rows”. forceReload() means “ask Maximo”. Loading and Displaying Data compares the four calls.
9 · “page-size is the number of rows a request asks for”#
The belief: page-size="20" sends a request for 20 rows, and a smaller page is a faster page.
What we measured: A datasource with page-size="20" sent oslc.pageSize=40. We saw the same factor for the page sizes from 3 to 20: 3 asked for 6, 5 for 10, and 10 for 20. The list shows the declared number, and the datasource keeps the second half in reserve.
The second half of the belief broke as well. A request for 10 rows with four attributes took 85 milliseconds. The request for 40 rows took 85 milliseconds too. A request has a fixed cost, and at this size the fixed cost is all there is.
Check it yourself: Open the network tab, open a page with a list, and read oslc.pageSize in the request.
The model that holds: Choose the page size for what two screens show, 20 to 40 rows. The number of attributes in the schema decides the cost of a large page far more than a small page size does. Pagination and Performance has the table from 10 to 500 rows.
10 · “A filter in memory sees what Maximo sees”#
The belief: Filtering is filtering. It makes no difference where it runs.
What we measured: Our test site has 1,483 work orders, and 46 of them contain the word “pump”. A datasource had loaded its first ten rows. We searched for “pump” in two ways:
| Call | Result |
|---|---|
search("pump") | one request to Maximo, 46 work orders |
| the same search in memory | no request, an empty list |
The search in memory looked into the ten loaded rows, found no pump there, and emptied the list. One more detail cost us time: search("") did not bring the rows back, and a call of clearInMemoryFilter() was needed for that.
Check it yourself: Load a list with a small page size. Run an in-memory filter for a value that exists only further down in the data.
The model that holds: A search or filter that asks Maximo sees every record. A filter in memory sees the rows on the device at that moment. Search and Filtering shows which call does which.
What the ten have in common#
| # | Belief | What happens instead |
|---|---|---|
| 1 | an empty list means nothing matches | the datasource may never have asked |
| 2 | a failing hook shows an error | the framework catches it, one console line |
| 3 | a wrong attribute name is refused | the select list skips it with status 200 |
| 4 | the preview equals the device | the preview runs a browser platform, as the developer |
| 5 | the user variable works in a where clause | it matches no row; "-userid-" works |
| 6 | hooks wait for each other | a hook is called and never waited for |
| 7 | a click runs one method | every controller with that name runs it |
| 8 | load() asks the server | a loaded datasource sends nothing |
| 9 | page-size is the request size | small pages are fetched two at a time |
| 10 | a filter in memory sees all records | it sees the loaded rows |
Most of the ten fail in silence. The screen shows no error and no warning, and the page looks fine. That is the pattern to take along: in Maximo Mobile, a wrong assumption rarely stops the app. It shows up later, as missing data.
The habit that protects against all ten is cheap. Open the network tab and the console, and read what the app really sent and said.
What to read next#
Controller Basics and Datasource Basics build the model behind these ten points from the ground up.
IBM documents the elements and attributes named here in the product itself. In the Application Configuration application, open the ? menu and choose Component Documentation. The REST parameters are described in IBM’s documentation of the Maximo REST API.
