Sun
Sun

Reputation: 2715

Maximo: show last status memo for current work order

In Maximo, I want to retrieve the most recent status memo and add the WOSTATUS.MEMO field to Work Order Tracking Module via Application Designer. In the Work Order Tracking application, to see the same information, you'd go to an individual Work Order > Select Action > View > Work Order History.

Upvotes: 1

Views: 1479

Answers (1)

Preacher
Preacher

Reputation: 2145

You may have noticed the WOSTATUS relationship on the WORKORDER object and found that you can't control which of the many WOSTATUS records for this work order gets chosen for showing the memo. You'll need to make a copy of this relationship which specifically finds the latest record. To find that latest record, you could go for the WOSTATUS record with the CHANGEDATE matching the STATUSDATE on the work order or with the highest WOSTATUSID. Assuming you go for the former, because it doesn't require a subquery, you'll create a new relationship from WORKORDER to WOSTATUS called LASTSTATUS with a where clause like this:

wonum = :wonum and siteid = :siteid 
and status = :status and changedate = :statusdate

You can then use the standard Relationship.Attribute syntax for the Attribute property of a Textbox in App Designer: LASTSTATUS.MEMO.

In case you were interested, here's the where clause you would use if you wanted to go for the WOSTATUSID instead:

wonum = :wonum and siteid = :siteid 
and wostatusid = (
    select max(wostatusid)
    from wostatus
    where wonum = :wonum and siteid = :siteid
    )

(Some may argue the toss about whether the first line in the above query is needed. I would respond with the suggestion to test for performance / optimal execution plan in your database environment.)

I hope that helps.

Upvotes: 1

Related Questions