Showing posts with label maximo. Show all posts
Showing posts with label maximo. Show all posts

Saturday, October 24, 2015

How to wrap data attributes in Birt Report

Below function would be useful for wrapping the data present in a field.

if(dataSetRow["description"]!=null){
function wrap(longStr,width){ length = longStr.length; if(length <= width) return longStr; return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width)); }wrap( dataSetRow["description"], 15 );
}

in the above function, i am trying to wrap description field to a size of 15.

Only disadvantage of this is that it includes hard stops so after every 15 characters which can be frustrating to a user who uses the report in a excel sheet.

----------------------------------------------------------------------------
All the messages below are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Wednesday, August 26, 2015

Maximo .. Update database using Birt report

Sometimes database has to be updated after each report run showing that a report  has been run(example like last run date).

In Birt simple way to achieve this is to execute update query in the 'beforeClose' method of dataset.



var myTxn = MXReportTxnProvider.create("maximoDataSource");


var updateSqlText = new String();

updateSqlText = " update poline set enterdate=SYSDATE  where enterdate is null'";

var apextractStmt = myTxn.createStatement();
apextractStmt.setQuery(updateSqlText);

myTxn.save();





---------------------------------------------------------------------------- All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

SQL Server & Maximo .. How to split GL account in SQL Server

Below query can be used in sql server to split a GL account which has 3 components in to individual components divided by '-' (ex : 100010123-abcd-1234 will be divided into gl1- 100010123, gl2- abcd , gl3 - 1234) .

select gldebitacc,

substring(gldebitacc,0,CHARINDEX('-',gldebitacc)) as gl1,

substring(gldebitacc,CHARINDEX('-',gldebitacc)+1,len(gldebitacc)-(CHARINDEX('-',gldebitacc)+charindex('-', reverse(gldebitacc)))), as gl2,

REVERSE(substring(reverse(gldebitacc),0, charindex('-', reverse(gldebitacc)) )) as gl3

 from

poline


----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Maximo Automation script .. How to find the parent Mbo and set value

Below is the sample code which can be used for finding the parent Mbo (ex invoiceline is parent for invoicecost) and setting values.I am using a attribute launchpoint on child mbo (ex invoicecost) which is called from invoiceline when filling gldebitaccout

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants


parentMbo=mbo.getOwner()
parentMbo.setValue("description","test", MboConstants.NOACCESSCHECK|MboConstants.NOVALIDATION_AND_NOACTION)



----------------------------------------------------------------------------

 All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Maximo Automation Script .. Split GL account

Below is the script which can be used for splitting the GL account to components

from psdi.mbo import MboConstants
from psdi.mbo import GLFormat
from java import util

 glComp1=mbo.getValue("gldebitacc").split('-')[0]
glComp2=mbo.getValue("gldebitacc").split('-')[1]
glComp3=mbo.getValue("gldebitacc").split('-')[2]

----------------------------------------------------------------------------

All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Wednesday, November 19, 2014

Sending mails using automation script in Maximo.




Here I am going to explain the process of sending mails from maximo automation script. Here I am taking example of sending emails whenever there is a change in status of work order.

 

·         Create a communication template like ‘WOSTATUS’

o   Template : WOSTATUS

o   Description :  Work order status change

o   Status: Active

o   Applies To : WORKORDER

o   Accessible From : ALL

o   Send From : maxadmin@xyz.com

o   Subject : WO :WONUM status changed

o   Description :  Workorder :WONUM has status changed.


 

·         Create launch point with details

o   Launch point : WOSTATUS

o   Description : status change launch point

o   Objective : workorder

o   Active – true

o   Add, initialize , update ,delete – true.






·          Create a automation script with below details

o   Script : wostatuscript

o   Script language : jython

o   Source code :

from psdi.util.logging import MXLogger

from psdi.util.logging import MXLoggerFactory

from psdi.mbo import MboConstants

from psdi.server import MXServer

 

logger = MXLoggerFactory.getLogger("maximo.script");

logger.debug("==================== wostatus." + launchPoint + ": START =====================")

 

user = mbo.getUserInfo()

mboServer = mbo.getMboServer()

commTemplateSet = mboServer.getMboSet("COMMTEMPLATE", user)

commTemplateSet.setUserWhere("TEMPLATEID = 'WOSTATUS' ")

commTemplate = commTemplateSet.getMbo(0)

 

if mbo.getMboValue("status").isModified():

    commTemplate.sendMessage(mbo)

 

 

logger.debug("====================wostatus" + launchPoint + ": END =====================")





----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Thursday, November 13, 2014

How to convert a string value to double in Birt report.


In the below example i am converting a string(UPPER) attribute to double value to perform so math calculations.

row["ASSETNUM"]=Double.parseDouble(mainDataSet.getString("ASSETNUM"));


----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Friday, October 31, 2014

IBM Maximo - Automation Script - Fetching OwnerName in automation script in Maximo ?


In  Maximo we can use the below jython script  to fetch Owner name of an mbo
logger.debug("=========================================)
if mbo.getOwner():
  ownerName = str(mbo.getOwner().getName())
  logger.debug("MBO Owner Name: " + str(ownerName))
logger.debug("=========================================)

----------------------------------------------------------------------------
All the messagesbelow are just forwarded messages if some one feels hurt about it please add your comments we will remove the post.Host/author is not responsible for these posts.

Friday, October 30, 2009

CTGIN2398E : An existing maximo db version is not valid and this installer requires minimum version is 7100

We are getting this error while installing Maximo 7 version .

Debuging : While debugging we found that maxvars table already existed in that particular database.

select * from maxvars

is giving us result and if this table exists it tells maximo that it wants to run an update installer not a fresh installation


Solution : If it is a fresh installation then please clean all the database properly .If database is on a shared environment please ask your DBA to hit

select * from dba_objects where object_name='maxvars'

if it has maxvars as public synonym by some other maximo it will be an issue for our installation

if you like this please leave your comments.

Tuesday, September 15, 2009

Importing Library.xml in Maximo


Importing Library.xml in Maximo

You can import Library.xml from the application designer. Follow these steps

  1. Go to 'Application Designer'
  2. Click on 'Import Application Definition' button in appbar
  3. Browse the location of 'Libarary.xml' and click 'Ok'
  4. Click on 'Save' button. This will replace the current existing Libaray.xml.


Tuesday, July 21, 2009

how to make a field mandatory or required in maximo

Field Level Class

For example you want to make a SerialNum field in Asset Screen mandatory based on some requirement we need to modify in your specific class

getMboValue("SERIALNUM").SetRequired(true);

Automation Script

Similarly below script can be used to make a field required using Automation script.

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants

logger = MXLoggerFactory.getLogger("maximo.script");
logger.debug("==================== MandatoryAUTOSCRIPT  START =====================")
mbo.setFieldFlag("SERIALNUM",MboConstants.REQUIRED, True)
logger.debug("==================== MandatoryAUTOSCRIPT  END=====================")

Thursday, June 4, 2009

Configuring BIRT..issue "There are errors evaluating script"

The following items have errors:
ReportDesign (id = 1):
+ There are errors evaluating script "importPackage(Packages.com.ibm.tivoli.maximo.report.script);

mxReportScriptContext = MXReportScriptContext.initialize(reportContext);
mxReportScriptContext.setDefaultLogLevel("DEBUG");
mxReportScriptContext.setDefaultLogFile("c:/temp/asset.txt");".

Table (id = 7):
+ There are errors evaluating script "maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());
maximoDataSet.open();

var sqlText = "select assetid, siteid, assetnum, description, location, binnum, parent, assettype, "
+ " status, priority, itemnum, islinear, installdate, manufacturer, "
+ " assettag, budgetcost, ytdcost, totalcost, warrantyexpdate,purchaseprice, "
+ " replacecost, moved, changedate, failurecode, conditioncode from asset "
+ " where " + params["where"];

maximoDataSet.setQuery(sqlText);".
+ There are errors evaluating script "if (!maximoDataSet.fetch())
return (false);

We did some silly mistakes because of which we were getting this error.Our mistake was we were not using the recomended JDK version.Please use JJDK1.5 version to solve this issue