Come for answers, stay for best practices. All we're missing is you.
A Maximo 7.6.1.x customer requested to concatenate certain Service Address fields and display them as a single value in a custom field in a Maximo application. The field was also sent over to an external system in an outbound message.
We updated an existing Automation Script which fired on WORKORDER Save (Object Launch Point). We used the Python List Comprehension technique to efficiently iterate over the Mbo Attributes of our choice (in a list), and then concatenate the values in a string.
The following code snippet illustrates our solution.
attributes = ['STADDRUNITNUM', 'STADDRNUMBER', 'STADDRSTREET', 'PLQUADRANT', 'CITY'] servaddress_set = wo_mbo.getMboSet('LOCATION.SERVICEADDRESS') if not(servaddress_set.isEmpty()): servaddress = servaddress_set.moveFirst() if servaddress: valueDataList = servaddress.getMboValueData(attributes) wosa_formatted_address = ' '.join([str(x.getData()) for x in valueDataList])
Here is a brief explanation of the code snippet above:
mbo.getMboValueData(attributes)
getData()
join()
Hope my fellow Maximo developers find this useful.