Maximo Open Forum

 View Only
  • 1.  How to create a variable for a dotted notation value?

    Posted 04-24-2022 20:27
    I recently created an Automation Script to verify if the currently opened PR had a value in a related field on the Companies table. I normally just create a variable in the script to pull in dot notation values like this:


    In my script I can create a variable on the SITEID easily:

    from psdi.mbo import MboConstants
    from psdi.server import MXServer
    
    # Set variable to current SITEID record field value
    PR_SITEID = mbo.getString("SITEID")
    
    
    # Do comparison of variables set to trigger alert
    
    if PR_OUNAME is None and PR_SITEID in ['ACME_CO', 'ACME_INC']:
        warngroup = "PR"
        warnkey = "null_vendor_ouw"
    elif PR_OUNAME is None and PR_SITEID not in ['ACME_CO', 'ACME_INC']:
        errorgroup = "PR"
        errorkey = "null_vendor_oue"
    else:
        print 'record ok'​


    How can I create a variable for "PR_OUNAME" within the Automation Script for the dotted notation value, without having to add the variable in the variable rows?

    #Customizations

    ------------------------------
    Jason Verly
    Agropur
    ------------------------------


  • 2.  RE: How to create a variable for a dotted notation value?

    Posted 04-25-2022 08:45
    Edited by Danielle Shaw 04-25-2022 08:52
    To retrieve that field in the script you can use dot notation like this:

    PR_OUNAME = mbo.getString("COMPANIES.EBS_OUNAME")​
    ​​
    You can do the following as well. I tend to use this when there is a one to many relationship and I need to loop through the second mbo or when I'm setting values. But the above should work fine so this is just informational:

    companiesMbo = mbo.getMboSet("COMPANIES").moveFirst()
    if companiesMbo is not None:
        PR_OUNAME = companiesMbo.getString("EBS_OUNAME")​​​

    ------------------------------
    Danielle Newhouse
    ------------------------------



  • 3.  RE: How to create a variable for a dotted notation value?

    Posted 04-25-2022 11:34

    Thanks for the answers. I tried the first option by trying to call the dotted notation field, but that didn't work for some reason. 

    I'll try the second method and report back. 



    ------------------------------
    Jason Verly
    Agropur
    ------------------------------