cancel
Showing results for 
Search instead for 
Did you mean: 

how to update tuple data in MDM from MDM Java API

Former Member
0 Kudos

Hi,

How to update the tuple data in MDM? can anybody help me to do this.

regards,

Ushasree P

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Sree,

Try to do following

TupleValue tupleValue = null;

String tupleRecordId = null;

//Get the tuple recordId which you want to modify

if(tupleRecordId!=null){

tupleValue = MdmValueFactory.createTupleValue(new TupleRecordId(tupleRecordId));

}

//Set the values For this tuple and excute ModifyRecordCommand.

Hope this helps

Answers (2)

Answers (2)

nitin_mahajan2
Contributor
0 Kudos


TupleValue tvPhoneNumber ;

FieldId fiPhoneNumber;

MdmValue mvPhoneNumber = new StringValue(u201C1231231231u201D) ;

tvPhoneNumber.setFieldValue( fiPhoneNumber , mvPhoneNumber ) ;

//set the tuple value to the field id of the record using the record.setFieldValue( id, value ) ;

Assuming you have a multi tuple value, then you would need one more step.


//get the field value of the multi tuple value from record and get the tuple value on an index.
MultiTupleValue mtvAddress ;

FieldId fiPhoneNumber;

TupleValue tvPhoneNumber  = mtvAddress.getValue(int index) ;

MdmValue mvPhoneNumber = new StringValue(u201C1231231231u201D) ;

tvPhoneNumber.setFieldValue( fiPhoneNumber , mvPhoneNumber ) ;

mtvAddress.modifyTupleValue( tvPhoneNumber);

//set the multi  tuple value to the field id of the record using the record.setFieldValue( id, value ) ;

After doing either of the above steps you will have to run a modify records command on the main record.

I am submitting one document on deleting updating MDM records and should be published soon.

Regards,

Nitin

former_member189669
Active Participant
0 Kudos

Hi Ushasree,

Tuple record can be updated by following the below steps in sequence :

1) Create an instance of tuple value : MdmValueFactory.createTupleValue(tupleRecordId)

2) Retrieve existing Tuple value -

To retrieve the TupleValue/MultiTupleValue interfaces, use one of the following two methods:

a) Record.getFieldValue(tupleFieldId)

If the tuple record is part of the original table record that can be obtained using one of the Retrieve commands responsible for retrieving records.

b) TupleValue.getFieldValue(tupleFieldId)

If the tuple record is part of another tuple record (nested tuple structure)

3) Modify a tuple value using - TupleValue.setFieldValue(tupleFieldId, tupleValue

4) Set modified Tuple Value to an instance of a Record such as: Record.setFieldValue(tupleFieldId, tupleValue)

5) Execute ModifyRecordCommand with the prepared Tuple Value as input parameter.

Hope this helps.

Regards,

Vinay M.S