cancel
Showing results for 
Search instead for 
Did you mean: 

MDM 7.1 Java API - Adding Multivalue Tuple with more than one display field

former_member206107
Active Participant
0 Kudos

Hi,

I am able to add Multivalue tuple which has single display field (eg., Plants in Material master)

How to add Multivalue tuple which has more than one display field? (eg., Sales Data in Material Master).

Can you please help me with some sample codes?

Thanks and best regards,

Arun prabhu S

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member206107
Active Participant
0 Kudos

I am using this code...dont know if I am missing some thing.

MultiTupleValue mtvSales = new MultiTupleValue();

TupleValue tvSales1 = MdmValueFactory.createTupleValue();

FieldProperties[] mtFieldProperties =

Session_Values.getRepositorySchema().getTupleMemberFields(

"MDM_SALES_DATA");

TupleDefinitionProperties tdSales_data =

Session_Values.getRepositorySchema().getTupleDefinition(

"MDM_SALES_DATA");

TupleDefinitionSchema tdsSales_Data =

Session_Values.getRepositorySchema().getTupleDefinitionSchema(

tdSales_data.getId());

tvSales1.setFieldValue(

tdsSales_Data.getFieldId("MDM_SALES_ORGANIZATION"),

new LookupValue(new RecordId("R4")));

tvSales1.setFieldValue(

tdsSales_Data.getFieldId("MDM_DISTRIBUTION_CHANNEL"),

new LookupValue(new RecordId("R4")));

mtvSales.addValue(tvSales1);

Record emptyRecord = RecordFactory.createEmptyRecord(TID_Main);

try {

emptyRecord.setFieldValue(

FID_Material_Number,

new StringValue(strMatNr));

emptyRecord.setFieldValue(

Session_Values.getRepositorySchema().getFieldId(

"MDM_MATERIALS",

"MDM_SALES_DATA"),

tvSales1);

} catch (IllegalArgumentException e6) {

// TODO Auto-generated catch block

e6.printStackTrace();

} catch (MdmValueTypeException e6) {

// TODO Auto-generated catch block

e6.printStackTrace();

}

CreateRecordCommand createRecordCommand =

new CreateRecordCommand(Session_Values.connectionacc);

createRecordCommand.setSession(Session_Values.strUserSession);

createRecordCommand.setRecord(emptyRecord);

try {

createRecordCommand.execute();

} catch (Exception e) {

}

nitin_mahajan2
Contributor
0 Kudos

I don't think it would matter if the Tuple has a single or multiple display value. While creating the value from the API we do not specify the display properties. It is a design time property.

Can you check the logs and see whats the error you are getting?

Regards,

Nitin

Former Member
0 Kudos

Hey Arun,

Did you solve this???? i have the same issue...

regars

krishna