Quick Tip: On-the-fly MboSet relationships

At the heart of Maximo Java development is the MBO and at the heart of the MBO are the relationships between one object and another.  Bruno has a great write up on MBO relationships to get a better understanding of how relationships work.

For the most part, each object in Maximo should already have a relationship defined for most child objects, but in those scenarios where there is no out-of-the-box relationship, you can create one on-the-fly when working with java MBO’s.

Here is an example, in the code below, let’s say our ‘mbo’ variable is the Asset object which means there is a property on that object named “ASSETNUM” and “SITEID”.  This code will create a relationship between the ASSET object and the WORKORDER object based on the query provided and return a set of zero or more WORKORDER objects.

MboSet workOrderSet = mbo.getMboSet("$ASSET2WO", "WORKORDER", "ASSETNUM = :ASSETNUM AND SITEID = :SITEID");

So what does this mean?  The parameter ‘$ASSET2WO’ is an arbitrary name given to this relationship, the ‘WORKORDER’ is the child object, and the ‘ASSETNUM = :ASSETNUM AND SITEID = :SITEID’ is the relationship where clause.  This where clause uses dynamic variables (values that begin with ‘:’), so the ‘:ASSETNUM’ and ‘:SITEID’ are values that are populated from the parent MBO object, in this case, the Asset object.

Series Navigation< Screencast: Working with Maximo Mbo and MboSet’s

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobileEZPLanner and EZInsight.

Find Out More

One thought on “Quick Tip: On-the-fly MboSet relationships

  1. Hello,

    Thanks of this information.

    I have a scenario where there exists two Objects. say OBJECT1 and OBJECT2.
    Now I have one application where main object is OBJECT1. OBJECT1 has relationship(one-many) thru which we have displayed OBJECT2 records on same APP.

    OBJECT2 has one non-persistent flag say Marked. Its default value is (Unchecked).

    So assume that OBJECT1 —One to Many –OBJECT2(10 records).

    User checks check box(Marked) = 1 for 5 records of OBJEC2.

    Now on Button Click(Displayed on OBJECT1), I want to read only these 5 rows (where Marked=1) by relationship from OBJECT1—->OBJECT2.

    I tried it building new relationship on the fly or defining in the system as well with existing relationship where clause and Marked=1.

    But I am not able to get them. Actually Marked being non-persistent, the user modified value is not accessible at all.

    May I know any idea you have?

Leave a Reply