TRIRIGA

Maximo Real Estate and Facilities (The Evolution of TRIRIGA)

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

 View Only
Expand all | Collapse all

Question of customization for the separation character of flat file export function of Integration Object

  • 1.  Question of customization for the separation character of flat file export function of Integration Object

    Posted Fri August 01, 2025 02:47 AM
    I have a question about the Integration Object. When we choose "Flat" for the export type, we can choose "Tab /t", "Pipe |", or "Double Colon ::" for the separation character.
    Can we add "Comma ," to the separation character? We need to exchange data with Customer's existing system as a Comma Separated Value file.
    I added "Comma ," to the triIntegrationFileDelimiter list, then  "Comma ," is listed in the drop down list. I selected the "Comma ," for the separation character of the Integration Object screen, however each value is separated by tab (Not Comma) in the exported file. 
     
    I'd appreciate it if you answer my question.


    ------------------------------
    HIROYA OGIHARA
    ------------------------------


  • 2.  RE: Question of customization for the separation character of flat file export function of Integration Object

    Posted Mon August 04, 2025 02:02 AM
    Edited by Lars Kools Mon August 04, 2025 02:02 AM

    Hi Hiroya,

    We created a simple automation script with an action launch point. See below the source code. This script can run based on a scheduled escalation and will export a csv file to a designated location (defined in a system property). Within the script you can define the headers and data attributes. Besides, you can define the separators in the config properties at the top. 

    Regards,
    Lars


    ## CONFIG

    #File parameters
    sep=","
    textqual='"'
    CR = '\r'
    LF = '\n'

    #imports
    from psdi.server import MXServer
    import time
    from psdi.mbo import MboConstants
    from psdi.util import HTML

    mxServer = MXServer.getMXServer()
    systemUser = mxServer.getSystemUserInfo()

    #Export directory, stored in system property
    exportdir = mxServer.getSystemProperties().getProperty("[yourproperty.property]")

    #selection where clause
    woWhere = "WOCLASS='WORKORDER' and ISTASK=0 and HISTORYFLAG=1 and SITEID='xxxxx' and WORKTYPE in ('PM','CM') and CHANGEDATE between trunc(sysdate-7) and trunc(sysdate))"

    scriptHomeSet = mxServer.getMboSet("WORKORDER", systemUser)
    #get data based on where clause
    scriptHomeSet.setWhere(woWhere)
    scriptHomeSet.reset()
    scriptHomeSet.setFlag(MboConstants.DISCARDABLE, True);

    woCount=scriptHomeSet.count()

    #open file 
    f=open(exportdir+"/MAXIMO_WO_"+timeStamp+".csv","wb")

    #write file headers
    f.write("SITEID"+sep+"WONUM"+sep+"PARENT"+sep+"DESCRIPTION"+sep+"WORKTYPE"+sep+"WOPRIORITY"+sep+"STATUS")
    f.write(CR+LF)

    #loop through records and write data to file
    for i in range(scriptHomeSet.count()):
      rmbo= scriptHomeSet.getMbo(i)

      f.write(rmbo.getString("SITEID")+sep)
      f.write(rmbo.getString("WONUM")+sep)
      desc=rmbo.getString("DESCRIPTION")
      desc = desc.encode("ascii","ignore")
      desc=desc.replace('"',"''")
      desc=desc.replace(LF, " ")
      f.write(textqual+desc+textqual)
      f.write(sep)
      f.write(rmbo.getString("WORKTYPE")+sep)
      f.write(rmbo.getString("WOPRIORITY")+sep) 
      f.write(rmbo.getString("STATUS")+sep)  
      f.write(CR+LF)
      
    f.close()
    scriptHomeSet.close()



    ------------------------------
    Lars Kools
    ------------------------------