Maximo Open Forum

 View Only
  • 1.  Problem exporting receipts from autoscript

    Posted 06-06-2023 05:49

    We have the need to export a lot of receipts, one receipt at a time, from three different systems.  We wrote an autoscript to retrieve the records via Where Clause, which we are then calling via the OSLC URL.

    For two systems, this worked just fine, but we can't make it work on the third system.  Two of the systems are the same fix pack (7.6.0.9) - one works, and the other doesn't.  In the log, it looks like the autoscript is running, but nothing's happening.  We've checked the usual things, i.e. the Publish Channel is enabled, etc.  Can anyone help with this? 

    The script is:

    from psdi.iface.mic import MicService
    from psdi.security import UserInfo
    from psdi.server import MXServer
    from psdi.mbo import MboConstants
    from psdi.util.logging import MXLogger
    from psdi.util.logging import MXLoggerFactory
    from java.lang import System
    from java.util import Calendar
    from java.text import SimpleDateFormat

    logger = MXLoggerFactory.getLogger("maximo.script");
    logger.info("############## SCO Terminal Journals Exporting Started")

    myMXServer = MXServer.getMXServer()
    userInfo = myMXServer.getSystemUserInfo()
    logger.info("############## userInfo = "+str(userInfo))
    MatUseSet = myMXServer.getMboSet("SERVRECTRANS",userInfo)
    MatUseSet.setWhere("servrectransid in (21316318062) ")
    MatUseSet.reset();
    matusecount=MatUseSet.count()
    logger.info("############## matusecount = "+str(matusecount))
    for i in range(matusecount):
     logger.info("############## Inside If = "+str(matusecount))
     matuseid=MatUseSet.getMbo(i).getInt("SERVRECTRANSID");
     whereclause="servrectransid="+str(matuseid)+"";
     logger.info("############## whereclause = "+str(whereclause))
     myMXServer.lookup("MIC").exportData("DPWSCOSERREC","DPWGENGES",whereclause,userInfo,0)

    Thanks in advance for any help.

    Shannon


    #Integrations

    ------------------------------
    Shannon Rotz
    InComm Solutions Inc.
    ------------------------------


  • 2.  RE: Problem exporting receipts from autoscript

    Posted 06-07-2023 10:19

    In your script, There is a hard coded value of servrectransid, have you checked if this ID exists into DB of 3rd system?

    MatUseSet.setWhere("servrectransid in (21316318062) ")

    Also, not sure why you are fetching again servrectransid  matuseid=MatUseSet.getMbo(i).getInt("SERVRECTRANSID"); when you already have it and hardcoded in line above



    ------------------------------
    Prashant Sharma
    Sedin Technologies
    Connect with me @ https://www.linkedin.com/in/psharmamaximo/

    #IBM Champion 2022
    #IBM Champion 2023
    ------------------------------



  • 3.  RE: Problem exporting receipts from autoscript

    Posted 06-07-2023 12:42

    Hi Prashant - thanks for the reply.  We were setting the Where Clause to one record as a test, which is why they were the same.  Normally the setWhere would have been including multiple records.

    Anyway:  I figured it out.  We got clobbered by a newbie mistake, i.e. 

     matuseid=MatUseSet.getMbo(i).getInt("SERVRECTRANSID");

    SERVRECTRANSID is a BIGINT data type, so it doesn't really work to try to use "mbo.getInt()" as a method to retrieve the value.  Apparently if you do that, and the value is small enough, Maximo will do an implicit data conversion from BIGINT to INT.  That's what it did in the other databases.  But if the value is large enough, it won't be able to do that, of course.  Unfortunately Maximo wasn't SAYING the value was too large - it was just returning a negative number.

    We changed it mbo.getLong(), and it was fine.



    ------------------------------
    Shannon Rotz
    InComm Solutions Inc.
    ------------------------------