Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  erData.createChildrenData example

    Posted 06/24/21 08:49 PM
    Edited by System Admin 03/22/23 11:46 AM


    Hi guys,

    I am writing a script to do some transformations on a Publish Channel (User Exit after External Exit)

    I get the Child MBO element in, and then do some transformations on the data which is working, however, if the Child MBO element is not there in the XML,
    I want to create that element, and add an attribute LMMSUPPORTSTATUS in with value 'None'

    Please see below.


    lsDataSet = erData.getChildrenData("LMMSUPPORT")
    if lsDataSet is not None:
     for lsData in lsDataSet:
     erData.setAsCurrent(lsData)

     lsStatus = erData.getCurrentData("LMMSUPPORTSTATUS")
     if lsStatus == "TEST":

    ##Do a few transformations ; Above part is working fine

    #Need help on this section below
    else:
     erData.createChildrenData("LMMSUPPORT",1)
     erData.setCurrentData("LMMSUPPORTSTATUS","None")
     erData.setParentAsCurrent()




     I haven't used createChildrenData() before, so I might be missing something simple here?

    ------------------------------
    KKunnuthara
    ------------------------------
    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: erData.createChildrenData example
    Best Answer

    Posted 06/27/21 08:48 PM
    The issue is resolved. It had to do with the 'if' check.
    I changed the 'if' statement as below, and then it worked.



    lsDataSet = erData.getChildrenData("LMMSUPPORT")
    if lsDataSet:
    #Do something
    else:
     erData.createChildrenData("LMMSUPPORT",1)
     erData.setCurrentData("LMMSUPPORTSTATUS","None")
     erData.setParentAsCurrent()


    ------------------------------
    KKunnuthara
    ------------------------------