Thursday, 18 July 2013

Increase MAXSEQUENCE in SQL Server

Some times developers will insert records using sql script.

Oracle database : you can get sequenceid by using NEXTVAL.

SQL Server : There is no function called NEXTVAL. Below are the steps you can follow :


SET NOCOUNT ON;

--Declare integer variable
declare @seqid int

--Update MAXSEQUENCE table by increasing MAXRESERVED value+1.
update [maxsequence] set [maxreserved] = [maxreserved]+1 where [tbname] = 'MAXATTRIBUTE' and [name] = 'MAXATTRIBUTEID'
GO

--Get MAXRESERVED from MAXSEQUENCE table and Set to integer variable (in this case @seqid)
SET @seqid = (select maxreserved from maxsequence  where [tbname] = 'MAXATTRIBUTE' and [name] = 'MAXATTRIBUTEID')

--When inserting use @seqid at your sequenceid value. Below case, MAXATTRIBUTEID value replaced with @seqid.
INSERT INTO MAXATTRIBUTE
 (MAXATTRIBUTEID,OBJECTNAME,ATTRIBUTENAME,.................) VALUES
( @seqid,<OBJECTNAME>,<ATTRIBUTENAME>,.........)
GO

For multiple inserts, add 'update step' and 'set sequenceid in variable step' before every insert :


--Update MAXSEQUENCE table by increasing MAXRESERVED value+1.
update [maxsequence] set [maxreserved] = [maxreserved]+1 where [tbname] = '<OBJECTNAME>' and [name] = '<OBJECTSEQUENCEIDNAME>'
GO

--Get MAXRESERVED from MAXSEQUENCE table and Set to integer variable (in this case @seqid)
SET @seqid = (select maxreserved from maxsequence  where [tbname] = '<OBJECTNAME>' and [name] = '<OBJECTSEQUENCEID NAME>')


INSERT INTO <OBJECTNAME>
 (OBJECTSEQID,,.................) VALUES
( @seqid,,.........)
GO

Hope it will be useful. :)


Add default value to long description field.

It is same as assigning default values to other fields.

Go to Application Designer --> Select your application --> go to require section --> drag and drop default value control from control palette --> select control properties for default value :

Attribute : Click on lookup and select attribute as DESCRIPTION_LONGDESCRIPTION for your object.
Value : <Add your default text>
Default Type : Insert <this will work while inserting new record in your application>

Save the application designer and try to insert new record in your application. Long description field will display your default text value entered in VALUE field.

Hope it will be useful :)

Friday, 7 September 2012

Maximo 7: System properties objects/tables

System properties are storing in below objects:

1. MAXPROP
2. MAXPROPVALUE
3. MAXPROPINSTANCE

1. MAXPROP: This object stores the header information of system property. "propname" is unique.
2. MAXPROPVALUE: This object stores the system property value. "propname" is unique.
3. MAXPROPINSTANCE: This object stores the information of instance properties.

Friday, 22 June 2012

BMXAA7136E - Validation failed when the database default values are set to the object during its creation.

Error: BMXAA7136E - Validation failed when the database default values are set to the object during its creation. BMXAA3097E - The person does not exist or is not active.

Solution:

1. Verify if SR.REPORTEDBYID default value is &USERNAME&
2. if it exists, change it to &PERSONID&

Mostly this error will occur, when inserting new record into service requests application. If default value is set to &username&, it is trying to put login username into reportybyid field. Which is wrong. Reportbyid field is validating against Persons, not for user names.

Note: This error will occur, if userid and personid is not same.

Saturday, 26 May 2012

Change status of Inbound interface records using MIF


This article may be helpful to Maximo Integration developers.

There may be some cases where some application records maintains in both Maximo and external ERPs. Sometimes, statuses of those records get updated in external ERP and will send data to Maximo. In such cases, Maximo get data from inbound interfaces by using Maximo Integration Framework.

Lets take a example of Invoice application;
  1. Created a Invoice 'I1234'  with line times and status is 'ENTERED'.
  2. Sent Invoice record details to External ERP.
  3. External ERP changed status to 'APPR' and sent Invoice status details to Maximo.
  4. To receive status data from External ERP to Maximo, you must use 'STATUSIFACE' field of INVOICE object.
    1. It means, while creating object structure for inbound interfaces (enterprise services), add STATUSIFACE field of your main object.
    2. Object sturcture: TESTINVOCIE
    3. Object: INVOICE
    4. Exclude/Include fields option: exclude all fields which are not required and make sure STATUSIFACE field is not excluded.
    5. Fields in Invoices are: INVOICENUM,SITEID,STATUS,STATUSIFACE
    6. Inbound data will be : I1234,SITE01,APPR,0
    7. In enterprise services, Object processing rule, set STATUSIFACE = 1.
    8. Inbound data will change to : I1234,SITE01,APPR,1
    9. This will change the status of Invoie to APPR in Maximo.

Thursday, 5 April 2012

How to create field validation class which extends MAXTableDomain

1. Write a custom field validation class and extend MAXTableDomain. (import psdi.mbo.MAXTableDomain)
2. Create a constructor and set a relationship with Object (table name).
3. Set a list criteria in the constructor itself (where clause for the above object).
4. If you would like to filter with more where clauses then write a getList() method.
5. Associate this field validation class to attribute in DB Configuration. And make sure that domain is not associated to this attribute.
Sample Class:
public class CustomFeildClass extend MAXTableDomain
{

public CustomFeildClass (MboValue mbv) throws RemoteException
 {
super(mbv);

String thisAttrName = getMboValue().getAttributeName();
setRelationship("FAILURELIST","failurecode=:"+ thisAttrName)
// Note: Here FAILURELIST is a Object. Most of the developers will confuse that it is a relationship name.
 
setListCriteria("parent is null");
//Note: this sets a where condition for the above object.
setErrorMessage("asset","failurecode");
 
 }
public MboSetRemote getList() throws MXException, RemoteException
 {
String additionalWhere ="orgid=:orgid";
setListCriteria(additionalWhere);
//Note: this sets additional where conditional to display when user clicks on lookup.
}
}
 

Wednesday, 4 April 2012

How to create custom condition class

There are two types of Conditions in Condition Expression Manager:
1. Expression
2. Class


To use Type Class in Condition, need to create a custom condition class.
1. Create a custom condition class which implements CustomCondition interface.
eg:
public class ConditionClass implements CustomCondition {
public boolean evaluateCondition(MboRemote mbo, Object param)throws MXException, RemoteException
if(<business logic>)

{
<business logic>
return true;
}
else{
<business logic>
return false
}
}
public String toWhereClause(Object parm, MboSetRemote msr)throws MXException, RemoteException

{
<business logic>
 return <sql>
}
}

2. CustomCondition interface have two methods:
a. evaluateCondition(MboRemote mbo, Object param): this method is used to evaluate condition and returns either true or false based on the business logic written in it. This return boolean value.
 b.toWhereClause(Object parm, MboSetRemote msr) : This method is used to return sql to the object which this condition is applied.This returns String.

Maximo SOAPUI error javax.xml.ws.WebServiceException

SOAPUI error while sending payload to below url (in cluster environment) http://localhost:9080/meaweb/services/MXASSET Error : <f...