Hey Jordan,
This worked for me as a Run Action Attribute Launch Point (ASSETMETER.REMARKS) script:
from psdi.mbo import MboConstants
def main():
# Ensure you're dealing with the expected Mbo type
if mbo is not None and mbo.isBasedOn("ASSETMETER"):
# Check if the attribute has been updated/modified
if mbo.isModified("REMARKS"):
# Get the updated value from the ASSETMETER object
remarks = mbo.getString("REMARKS")
# Retrieve the related MboSet (Using MEASUREMENT relationship on ASSETMETER object)
measurement_set = mbo.getMboSet("MEASUREMENT")
measurement = measurement_set.moveFirst()
# Loop through each Measurement Mbo in the set
while measurement is not None:
# Update the COMMENTS field in the MEASUREMENT table
measurement.setValue("COMMENTS", remarks, MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION)
# Move to the next Measurement in the set
measurement = measurement_set.moveNext()
main()
Let me know how you make out.
Cheers,
------------------------------
Matt F
------------------------------
Original Message:
Sent: Tue August 27, 2024 01:53 PM
From: jay l
Subject: Carrying over AssetMeter Remarks to Measurement table
Currently trying to capture the remarks field from the assetmeter table to the measurement table's user defined field. What would be the best approach for this? I have dabbled with automation scripting with an object launch point and it seems to copy the field over and this is reflected in the UI, but the data does not commit to the database.
------------------------------
jordan lum
------------------------------