+ All Categories
Home > Documents > IBM Maximo Customization Scripting and Formulas

IBM Maximo Customization Scripting and Formulas

Date post: 16-Oct-2021
Category:
Upload: others
View: 4 times
Download: 0 times
Share this document with a friend
28
IBM Maximo Customization Scripting and Formulas Oct 2018 Sean Stuckless [email protected]
Transcript
Page 1: IBM Maximo Customization Scripting and Formulas

IBM Maximo Customization Scripting and Formulas

Oct 2018

Sean [email protected]

Page 2: IBM Maximo Customization Scripting and Formulas

2

20 Years with IBM

12 Years with Maximo

Developer Engagement Scheduler KPIs Public

Mapping Frameworks

8 Years Online

Commerce

Supply Chain frameworks Integration

Who is this guy?

Page 3: IBM Maximo Customization Scripting and Formulas

3

IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision.

The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

DISCLAIMER

© Copyright IBM Corporation 2018. All rights reserved.

Page 4: IBM Maximo Customization Scripting and Formulas

4

Scripting and Formulas

Maximo thrives on customization and configuration

Fast and dynamic(if used properly)

Lots of integration points

Calculated fields using Formulas is natural

Workflow is OK, but, bulky for extending business logic

Page 5: IBM Maximo Customization Scripting and Formulas

5

Scripting and Formulas

Scripts

Actions

Objects

Global Service

MIF/REST

Library Script

Attributes

Conditions

CRONs

Can DeleteCan Add

SaveDuplicate

App ValidateInit

ExecuteBeforeAfter

After Commit

On Setup

InsertUpdateDelete

Init

Init ValueAction

ValidateGet List 7.6.0.5+

7.67.5

Page 6: IBM Maximo Customization Scripting and Formulas

Real Time Error

Library script

Warning

Invoke channel

logging

workflow

service var

Http calls

Invoking Endpoints

Global 'service' var

7.6.0.5+

7.67.5

Page 7: IBM Maximo Customization Scripting and Formulas

Service Examples7

service.error(grp,key)

service.error(grp,key,params)

service.setWarning("po","nolines", None)

service.yncerror("asset", "assetpr",params)

service.logError("an error happened")

service.invokeChannel(channelname)

* service in `ctx` in MIF OS Scripts

Page 8: IBM Maximo Customization Scripting and Formulas

8

MIF/REST

Object Structures

Enterprise Service

Publish Channel

Invoke Channel

MMI

Out

In

Query (REST)

Action (REST)

Request

Response

User Exit

External Exit

Before Ext Exit

After Ext Exit

User Exit

External Exit

Event Filter

Before Ext Exit

After Ext Exit

Request

Response

User Exit

External Exit

Before Ext Exit

After Ext Exit

MIF Endpoints

MIF/REST Scripting Points -Exits

7.6.0.5+

7.67.5

Page 9: IBM Maximo Customization Scripting and Formulas

9

Jython 2.7Better support

for add-on module in

Jython

Library Scripts with Multiple

FunctionsEasier to use

Library Scripts

Support for Closing Maximo

Dialogs ('action' Launchpoint)

New in 7.6.1

Page 10: IBM Maximo Customization Scripting and Formulas

10

Reusing Scripts – Library Scripts❖ Current way to write Library Scripts.

Script 1 – CALC_MULT

r = a*b

Script 2 – CALC_ADD

r = a+b

Page 11: IBM Maximo Customization Scripting and Formulas

11

Reusing Scripts – Library Scripts❖ Current way to consume such a Library Script.

from java.util import HashMapmap = HashMap()map.put("a",2)map.put("b",3)service.invokeScript("CALC_MULT",map)res = map.get("r")

Page 12: IBM Maximo Customization Scripting and Formulas

12

Reusing Scripts – Library Scripts❖ What you can do now (make sure that you set the script to Allow

Invoking Script Functions).

Script - CALC

def mult(a,b): return a*b def add(a,b): return a+b

Page 13: IBM Maximo Customization Scripting and Formulas

13

Reusing Scripts – Library Scripts❖ The script to consume it.

res = service.invokeScript("CALC","mult",[2,3])

Page 14: IBM Maximo Customization Scripting and Formulas

14

➢ Not closing cursors➢ Full access to Java and Maximo➢ Too many relationships➢ Too much database access➢ Calling expensive methods (Change Status)➢ Incorrect Lifecycle Event➢ Calling "Save"➢ Complex conditional Scripts

Scripting Performance and Common Problems14

Page 15: IBM Maximo Customization Scripting and Formulas

15

➢ One Stop - Samples / References➢ https://github.com/ibm-maximo-dev/maximo-scripting

➢ Auto Script Editor➢ https://tinyurl.com/maximo-autoscript-editor➢ Eventually will rolled into Maximo

➢ Auto Script Revisioning (Possible enhancement)

Dev Center + Future

Page 16: IBM Maximo Customization Scripting and Formulas

Formulas

Page 17: IBM Maximo Customization Scripting and Formulas

17

Formulas

➢ Calculated Fields - Mathematical expressions➢ Excel Like (Built-in functions)➢ Access Related Fields➢ Aggregation➢ Applied to Objects and Attributes➢ Extensible Function Framework in Java or Automation

Scripting➢ Easy Access from DB Configure Application➢ Persistent or Non Persistent➢ Immediate or Asynchronous 7.6.0.6+

Page 18: IBM Maximo Customization Scripting and Formulas

Formulas vs Scripting vs Java

Page 19: IBM Maximo Customization Scripting and Formulas

A

B

C

Code

Code

Code

C = f(A,B) - Java

• Code Attached to Each Field• Different Lifecycle for each Field• Rebuild Maximo Ear

Page 20: IBM Maximo Customization Scripting and Formulas

A

B

C

Script

Script

Script

C = f(A,B) - Scripting

• Script Attached to Each Field• Different Lifecycle for each Field• Configure Inputs/Outputs

Page 21: IBM Maximo Customization Scripting and Formulas

A

B

C

C = f(A,B) - Formula

• Single Function• Configured in Database Application• C auto-magically updated when A or

B Change

Formula

Page 22: IBM Maximo Customization Scripting and Formulas

22

➢ Approx 30+ Functions as of 7.6.1➢ min, max, round, pct, if, date, abs, pow, sqrt, …➢ Including aggregation functions, avg, sum, ...➢ Can Reference

➢Mbo attributes➢Maxvars➢System Properties➢Conditions➢Other Formulas

Formulas in Maximo

Page 23: IBM Maximo Customization Scripting and Formulas

23

Example: Using Conditional Logic

IF(pressuremeter$lastreading > 60, 1, IF(pressuremeter$lastreading > 20 && pressuremeter$lastreading < 59, 2, 3))

➢ Nested Logic➢ Relationships using the $ operator➢ Implicit type conversion from ALN to double, boolean, date

Page 24: IBM Maximo Customization Scripting and Formulas

24

Prefix Description Exampleprop System Property prop$propname * 1.5

var MAXVAR IF(var$maxvarname, 1, 2)

cond Maximo Condition field * IF(cond$conditionnum, 0.25, 0.75)

isnull In Null Test IF(isnull$installdate, 0, 1)

prev Previous Value IF(priority > prev$priority, 1, 0)

modified Is Modified Test IF(modified$priority, 1, 0)

Formulas - Prefixes

Page 25: IBM Maximo Customization Scripting and Formulas

25

Prefix Description ExampleSUMF Sum SUMF("childtask","estdur","actfinish",

DURATION(0,0,7,0,0,0))

COUNTF Count COUNTF("openwo","statusdate", DURATION(0,0,10,0,0,0))

oldest Oldest by Date oldest$openwo$wopriority$statusdate

latest Newest by Date latest$openwo$wopriority$statusdate

count Row count count$childtask

Formulas – Aggregation and Collections

➢ AVGF, MINF, MAXF also available

Page 26: IBM Maximo Customization Scripting and Formulas

26

➢ Formula➢Mathematical Calculation

➢ Scripting➢Validation➢Complex Updates (if then else)➢Business Logic

When to use Formulas vs Scripting26

Page 27: IBM Maximo Customization Scripting and Formulas

27

➢ Use aggregation sparingly➢ Too many relationships➢ Badly written user defined Functions➢ Complex Conditional Formulas

Formula Performance and Common Problems27

Page 28: IBM Maximo Customization Scripting and Formulas

THANK YOU


Recommended