Considering your other post about adding new data in MAXVARS (
Edit MAXVARS data via UI), I think it's worth circling back and thinking about what you're trying to achieve overall.
If your goal is to store a custom value (say the environment ID/designation) somewhere that you currently have not found a place to store, and use that in Automation Scripts, I would rather do that as System Properties. Those can be added through the UI, and you can go through the MXServer.getProperty() method in scripts to retrieve it.
Assuming you are using public properties:
from psdi.server import MXServer
publicProperty = MXServer.getMXServer().getProperty("company.public.propertyname")
H/T: https://stackoverflow.com/questions/52280850/fetch-system-property-in-automation-script-in-maximoI've seen this used for storing variables that are required to change quickly between environments and across multiple automation scripts, for instance an external system URL, an external system login ID etc.
We have some integrations that rely on automation scripts where our development environment maps to one ext. system, and the production system maps to another. By storing it in a System Property we can do changes to the scripts as needed and migrate them without worrying about any hardcoded values.
------------------------------
Henrik Christiansen
------------------------------
Original Message:
Sent: Thu October 07, 2021 12:34 AM
From: User1971
Subject: Get a value from MAXVARS using automation script
MAM 7.6.1.2:
I want to select a specific value from the MAXVARS table.
The SQL equivalent would be: select varvalue from maxvars where varname = 'MAXIMO_ENV'
Result: DEV
Is there a way to do that with a Java method in an automation script? (not with SQL)
Thanks.
#Maximo
#AssetandFacilitiesManagement