Tuesday, September 13, 2016

Maximo Automation Script : To make field value to remove special characters and to make it in upper case

Below script is used to remove the special characters and make values in the field to uppercase

Script
------
Name : ASSET-DESCRIPTION-REMOVE-SPLCASE
Language : jython

Launch Points
-------------
Name : ATT-REMOVE-SPLCASE
Active : 1
Object : Asset
Attribute : DESCRIPTION

Autoscript
----------

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants
from psdi.util import MXApplicationException

logger = MXLoggerFactory.getLogger("maximo.script");
logger.debug("==================== ATT-REMOVE-SPLCASE." + launchPoint + ": START =====================")

#This script reformats the Description field to only have alphanumeric uppercase characters
#Characters A-Z and 0-9 inclusive are permitted.

description = mbo.getString("DESCRIPTION")
description = ''.join(i for i in description if i.isalnum())
description = description.upper()
mbo.setValue("DESCRIPTION", str(description), 2)

logger.debug("==================== ATT-REMOVE-SPLCASE." + launchPoint + ": END =====================")
----------------------------------------------------------------------------
All the messages
below are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

No comments:

Post a Comment