Monday, 27 January 2020

PMSTATUS table to make history of PM records | Maximo

Maximo doesn't support us to have a history of status changes for Preventive Maintenance applications like XXSTATUS table is available for almost all applications.

We decided to have a history table for PM records also so that we know that who and when actually this record was modified.


1. in database configuration create a new object:

Attribute Type Length
CHANGEBY UPPER 30
CHANGEDATE DATETIME 10
DESCRIPTION ALN 50
DESCRIPTION_LONGDESCRIPTION LONGALN 32000
HASLD YORN 1
MEMO ALN 50
ORGID UPPER 8
PMNUM UPPER 20
PMSTATUSID BIGINT 19
SITEID UPPER 8
STATUS UPPER 20




2. Create an Attribute Automation Script by Goto -> System Configuration - > Automation Script:

Name : PMSTATUS
Object: PM
Attribute: Status
Event : Validate

Script:
from java.util import Calendar
cal = Calendar.getInstance();
vCurrentDateTime = cal.getTime();
vPMNUM = mbo.getString("PMNUM");
vPMStatus = mbo.getMboSet("$vPMStatus", 'PMSTATUS', '1=1');
if vPMStatus:
    vPMStatus.add();
    vPMStatus.setValue("ORGID","EAGLENA");
    vPMStatus.setValue("SITEID","BEFORD");
    vPMStatus.setValue("PMNUM",mbo.getString("PMNUM"));
    vPMStatus.setValue("CHANGEBY",user);
    vPMStatus.setValue("CHANGEDATE",vCurrentDateTime);
    vPMStatus.setValue("STATUS",mbo.getString("STATUS"));

3. We are done :)

Now If you want, you can show this table in one tab of PM record, or by creating a dialog like VIEW STATUS HISTORY.

for TAB as I displayed in the image above:

1. create relationship on PM object
Name: PMSTATUS
Child: PMSTATUS
Where: pmnum = :pmnum

2. create a Tab, and drag Table control and insert Table Column into it using Application Designer.
3. write PMSTATUS (relationship name) into properties of Table control as a relationship.
4. set attributes of each table column.


good to go.


1 comment:

  1. If you're attempting to lose fat then you certainly need to start following this totally brand new personalized keto plan.

    To create this keto diet service, licensed nutritionists, fitness couches, and professional cooks joined together to provide keto meal plans that are useful, decent, price-efficient, and delicious.

    Since their grand opening in early 2019, thousands of people have already transformed their body and health with the benefits a professional keto plan can provide.

    Speaking of benefits: in this link, you'll discover eight scientifically-confirmed ones offered by the keto plan.

    ReplyDelete