Hello All,
I have one requirement to Delete Company Code Tuple Values from Sales Table in MDM.
I tried using below code. But Its deleting values from Company Code field in Sales table.
Table Screen Shot. I want to delete Company Code Tuple data( highlighted by Red Color) in below screen shot

As per below code i print the message

As per below code.
@WebMethod(operationName = "deleteCCTupleRecord", exclude = false)
public String deleteCCTupleRecord(@WebParam(name = "strALCRCode") int strALCRCode,
@WebParam(name = "strP20Code") int strP20Code
)
throws ConnectionException, CommandException,
MdmValueTypeException, NullPointerException
{
String p20Id=null ;
HashMap hmHashMap =new HashMap();
try {
trustedMdmConnection = new TrustedMdmConnection(); connectionPool = trustedMdmConnection.getConnectionPool();
arrSessionCtx = new ArrayList();
arrSessionCtx.add(sessionCtx);
repoSchema = trustedMdmConnection.getSchema(arrSessionCtx);
trustedUserSessionId = trustedMdmConnection.getTrustedUserSessionId(arrSessionCtx);
MDMFrameworkUtility _frameworkUtilityLocal = new MDMFrameworkUtility();
_frameworkUtilityLocal.initialize();
p20Id = _frameworkUtilityLocal.getRecordID("CMD_MDM_SALES", "CMD_MDM_P20_CUSTOMER_NUMBER", "0000220063");
logger.errorT(" 5 :- "+p20Id);
/*RetrieveRecordsByIdExCommand objRetrieveRecordsByIdCommand = new RetrieveRecordsByIdExCommand(this.context);
logger.errorT("objExistingRecord--->" + objRetrieveRecordsByIdCommand);
objRetrieveRecordsByIdCommand.addId(new RecordId(p20Id));
ResultDefinition objResultDefinition = new ResultDefinition(repoSchema.getTableId("CMD_MDM_SALES"));
objRetrieveRecordsByIdCommand.setResultDefinition(objResultDefinition);
objRetrieveRecordsByIdCommand.execute();
Record objExistingRecord = objRetrieveRecordsByIdCommand.getRecords().getRecord(0);
logger.errorT("objExistingRecord--->" + objExistingRecord);*/
ArrayList arrResultSetFields = new ArrayList();
arrResultSetFields.add("CMD_MDM_COMPANY_CODE");
hmHashMap = _frameworkUtilityLocal.getValuesByRecordID("CMD_MDM_SALES", p20Id, arrResultSetFields);logger.errorT("hmHashMap:- "+hmHashMap);
ArrayList arrTupleList = (ArrayList) hmHashMap.get("CMD_MDM_COMPANY_CODE");
MultiTupleValue companyCodeTuple = new MultiTupleValue();
int listSize = arrTupleList.size();
logger.errorT("listSize:- "+listSize);
for(int j=0; j<listSize; j++)
{
logger.errorT("J::- "+listSize);
TupleValue roleOwnerTuple = (TupleValue) arrTupleList.get(j);
logger.errorT("roleOwnerTuple::- "+roleOwnerTuple.getDisplayValue());
logger.errorT("roleOwnerTuple Type::- "+roleOwnerTuple.getTupleRecordId());
companyCodeTuple.removeTupleValue(roleOwnerTuple.getTupleRecordId());
logger.errorT("Remove Method::- "+roleOwnerTuple);
}
/*objExistingRecord.setFieldValue(repoSchema.getFieldId("CMD_MDM_SALES", "CMD_MDM_COMPANY_CODE"), companyCodeTuple);
ModifyRecordCommand objModifyRecordCommand = new ModifyRecordCommand(this.context);
objModifyRecordCommand.setRecord(objExistingRecord);
objModifyRecordCommand.execute();*/
}catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
logger.errorT(e1.getMessage());
}
finally{
//mdmConfiguration.destroyMDMSession();
}
return p20Id;
}
Can you please help me on this issue. I am unable to find the problem.
Regards
Vijay.