cancel
Showing results for 
Search instead for 
Did you mean: 

NumberFormatException while Updation using MDM4J

Former Member
0 Kudos

Hi All,

We are trying to perform Update functionality using MDM4J APIs, but not able to move furthur as we are getting an exception in the code.

Following is the code we are using:

try {

A2iFields a2iFields = new A2iFields();

A2iField statusField = new A2iField("Current_Status");

Value statusVal = new Value(wdContext.currentVn_Status_changeElement.getVa_Changed_Curr_status());

statusField.SetValue(statusVal);

a2iFields.Add(statusField);

A2iField SubstatusField = new A2iField("Current_SubStatus");

Value SubstatusVal = new Value(wdContext.currentVn_Status_changeElement ().getVa_Changed_SubSts());

SubstatusField.SetValue(SubstatusVal);

a2iFields.Add(SubstatusField);

A2iField ProstatusField = new A2iField("Proposal_status");

Value ProstatusVal = new Value(wdContext.currentVn_Status_changeElement().getVa_Changed_Curr_status());

ProstatusField.SetValue(ProstatusVal);

a2iFields.Add(ProstatusField);

A2iField ProSubstatusField = new A2iField("Proposal_SubStatus");

Value ProSubstatusVal = new Value(wdContext.currentVn_Status_changeElement().getVa_Changed_SubSts());

ProSubstatusField.SetValue(ProSubstatusVal);

a2iFields.Add(ProSubstatusField);

A2iIntArray recIds = new A2iIntArray();

int recID = wdThis .wdGetCO_Resource_Availibility_CheckController() .getRecordID(

"Resource_Availibility_Check","Satyam_ID",associateID);

recIds.Add(recID);

ResultSetDefinition rsd = new ResultSetDefinition("Resource_Availibility_Check");

A2iResultSet rs = catalog.GetRecordsById(rsd, recIds);

int updateResult = catalog.UpdateRecord("Resource_Availibility_Check",

recID,rs.GetChangeStampAt(0),a2iFields);

On executing getting the following exception:

java.lang.NumberFormatException: For input string: "Others"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)

at java.lang.Integer.parseInt(Integer.java:468)

at java.lang.Integer.parseInt(Integer.java:518)

at a2i.core.Value.ConvertToType(Unknown Source)

at com.a2i.xcat.internal.conversion.StructsToStructsUtil.ConvertFieldsToModifiedFields(Unknown Source)

at a2i.common.CatalogData.UpdateRecord(Unknown Source)

at a2i.common.CatalogData.UpdateRecord(Unknown Source)

at com.satyam.rf.rac.view.VW_Associate_Selection.onActionShadow(VW_Associate_Selection.java:2032)

Line 2032 is teh line of the UpdateRecord method.

Please suggest what could be the problem in this code.

Thanks in Advance,

Becky.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Becky,

Issue seems to be with the below code:

A2iIntArray recIds = new A2iIntArray();

int recID = wdThis .wdGetCO_Resource_Availibility_CheckController() .getRecordID(

"Resource_Availibility_Check","Satyam_ID",associateID);

recIds.Add(recID);

I think you must initialize an int array and put the record Id at index 0 and then try adding.

You can also try commenting the above code and then try to update the record.

Cheers,

Arafat

Former Member
0 Kudos

Hi,

You might have created all the context elements of type String and trying to put the string value in the number field. Check the field types and context element type, both should be of same type.

Regards,

Jitesh Talreja

Former Member
0 Kudos

Hi Jitesh,

The context are of string type only and the fields mentioned are of Lookup type.

Regards,

Becky.

Former Member
0 Kudos

Hi,

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)

This shows that line 48 has some error. Try commenting Update method and check still you are getting the exception.

Regards,

Jitesh Talreja

Former Member
0 Kudos

Hi Jitesh,

If i comment the Update method, there is no exception coming. The problem is with the Update method only i guess.

Regards,

Becky.