Maxlookupmap related error


Hi All,

I am sure many of you have come across this error. I am going to describe in detail two methods to fix it.

maxlookup map error

Maximo framework figures out the foreign key mapping from one of three ways:

1) Attribute mapping registered in the MAXLOOKUPMAP table.

2) Attribute mapping defined in the field validation class as associated to the attribute in Database Configuration.

3) The automated matching process using the primary keys of the source object ( applink object or lookup object) and the fields in the target object.

In this post we will discuss the first two methods.

1) Using MAXLOOKUPMAP table:

Maximo framework makes use of a series of rules to figure out the mapping of fields to set values.

First the Maximo framework looks through the primary key column names of the source mbo and tries to match columns with the same name in the target mbo.

In the event that they match then it is thought about a valid match and the values of the source columns will be set to their same name counterparts.

If the names match, but they are not the name of the field in the lookup, Maximo will then look at the Same As Object and Same As Attribute values from the launch field as set in Database Configuration for that attribute.

If a match cannot be made an exception is thrown and the association needs to be made either through a validation class reference, or through the use of the MAXLOOKUPMAP table.

To set up a MAXLOOKUPMAP record for associating a lookup, you need to look at the columns of the MAXLOOKUPMAP table so you know what to populate them with.

The primary key of the table is TARGET, LOOKUPATTR, SOURCE, SOURCEKEY.

TARGET – The target object name which is the object the field launching the lookup exists in.

LOOKUPATTR – The attribute name for the field for which the value from the lookup will be returned to.

TARGETATTR – The target field in the target object to which the value is set, either manually or by the lookup selection.

SOURCE – The object the lookup or applink is set against. The object containing the values for the lookup.

SOURCEKEY – The source field from which the lookup value is selected.

SEQNUM – The sequence in which the multi-key lookup sets the target attributes.

ALLOWNULL – When a LOOKUPATTR is being directly set in an application, this indicates whether the attribute can be null or not. The ALLOWNULL attribute is not used during a multi-key lookup but is used when the LOOKUPATTR listed in the MAXLOOKUPMAP table is being directly set with a value such as a user directly typing a value in the field.

If any of the attributes other than LOOKUPATTR listed in the TARGETATTR column are set to ALLOWNULL false, then they have to be set (have a value) before setting the LOOKUPATTR field. If more than one attribute with ALLOWNULL set to false exist, then those fields must all be set before the LOOKUPATTR field can be populated.

2) Using Field Validation Class:

This is a special field validation class because it extends MAXTableDomain. This method is mostly used if we already have a field validation class associated with a field and cannot attach a domain. If we are able to attach a domain to a field, the best option is the above i.e. using MAXLOOKUPMAP table.

In the constructor of this field validation class we provide the lookup mapping using “setLookupKeyMapInOrder” method.

Following is the javadoc comments for this method:

public void setLookupKeyMapInOrder(java.lang.String[][] map)
This method should be called to identify which attribute on the lookup MBO should be set to which attribute on the target MBO when the lookup returns. The order should be in the same sequence when the values will actually be set. This order is especially important if there are any attribute that cannot be null when the other attribute is set. In this case, the cannot be null attribute should be ahead in the order. If there is only one key attribute of the lookup table, the attribute should also be specified here. This method should be called in the constructor or when domain id is set. * @param map The array of String[2]. First one is the attribute of the target MBO and the second one is the attribute of the lookup table.

So, by calling this method in the constructor we have provided the mapping which the framework will use when it needs to identify the source and target fields.

Please let me know if you have any questions.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s