Have you ever used the Asset Down Code?
I have been working with Maximo since 1999 [v4] and only recently have I had a client using the Asset Down Code. Seems simple enough, select a code from the domain list and click OK.
It makes sense they want to see the Asset Down Code on the Asset List screen and the Asset tab. So I start with an *Alt-I to figure out what table I am dealing with here.
The DOWNTIMEREPORT table is non-persistent. Oh but I can use the ASSETSTATUS table and the CODE field to show the down code. This seems all well and great until you want to change the down code when you bring the asset back up or if you ever have to take it down again. **The down code from the ASSETSTATUS table never seems to change.
I tried a number of things including unsuccessfully populating another field to show the down code. Then I scoured google for some answers but there was nothing on asset down code in Maximo. Hence why I’m writing this.
I stepped away and kind of avoided this for a bit. When I came back to it I had gained access to do sql select statements and that made a huge difference in what I was seeing. If you take the Asset down and up several times there is, of course, many lines of data for that one asset in the ASSETSTATUS table [see image below]. The code field in the ASSETSTATUS table would show the first down code not the most recent on the asset screen. So it’s not working correctly but even if it did there was more the client wanted.
The client wanted to see the asset down code on the asset and the list screen when the asset was down but when the asset was brought back up the asset down code would be cleared. Makes complete sense and I really wanted to make this happen for them. So back to automation scripts to see what I could do.
I was still positive I would need to add a field to the asset table and I knew I needed to figure out how to grab the most recent down code from the ASSETSTATUS table but dates are a bear to work with. Finally, I realized I needed to use greater than or less than in regards to the dates.
Here is how I did it:
In Automation Scripts I created an Object Launch Point. The object is ASSET, the event is Save and the save is on Add and Update, Before Save.
There are five variables to define. From ASSETSTATUS we need the Change Date [1] and the code [2]. From ASSET we need Is Running [3] and the new asset down code field [4]. Lastly, we need the system date [5]. To define the system date the binding type will be LITERAL and you must populate the Global Binding Value as &SYSDATE& and the Launch Point Binding Value as &SYSDATE&.
Now for the Source Code:
I had to play around with the greater than, less than but what worked is to have the change date less than the system date and the asset is down. Granted all of the change dates will be less than the system date but it grabs the most recent.
if chdte < thedte and isrunning == 0:
If those conditions are met it’s like a crossover and the new asset down code field will equal the most recent code pulled from the ASSETSTATUS table.
downcode=code
We are not done yet because when the asset is brought back up:
if isrun == 1:
Then we want to clear the new asset down code field.
downcode=”
All together with the proper indents it looks like this:
if chdte < thedte and isrun == 0:
downcode=code
if isrun==1:
downcode=”
Now to save and test and test and test.
Voilà
Now every time the asset is taken down and the downtime code is selected in the reporting downtime dialog box it populates into the new asset down code on the asset tab. When the asset is brought back up the new asset down code is cleared no matter what is in the downtime code in the reporting downtime dialog box.
*Alt-I is a shortcut key to display field help. Funnily enough, when you search for such a Maximo shortcut key it’s says Alt-F1. You can find more shortcut keys here.
**The down code from the ASSETSTATUS table never seems to change. I have notified IBM about this possible bug and they are investigating.