cancel
Showing results for 
Search instead for 
Did you mean: 

To read a calculated field of an MDM record

Former Member
0 Kudos

Hi All,

We have a main table in MDM repository with a calculated field and other fields.

On entering the values of other fields in the table an ID gets generated for the calculated field of that main table.

Now we want to retrieve that calculated field Id.Can anyone provide pointers for the same?

Regards,

Richa

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Richa,

To retreive calculated field you can use RefreshCalculatedFieldsCommand

ResultDefinition resDef = new ResultDefinition(schema.getTableId("TableId"));

resDef.addSelectField((FieldId)fieldId.get("fieldId"));

RetrieveRecordsByIdCommand varCmd = new RetrieveRecordsByIdCommand(wdContext.currentContextElement().getVa_ConnectionStr());

varCmd.addId(VarRecord.getId());

varCmd.setSession(wdContext.currentContextElement().getVa_SessionId());

varCmd.setResultDefinition(resDef);

varCmd.execute();

RecordResultSet recResSet = varCmd.getRecords();

Record resRecord = recResSet.getRecord(0);

wdControllerAPI.getMessageManager().reportWarning("functionsave:SaveVarietyData( )*********07"+resRecord.toString());

MdmValue varCreated = resRecord.getFieldValue((FieldId)fieldId.get("Variety_Material_Number_Inter"));

String varCreatedVal = varCreated.toString();

Integer varNumCreated = new Integer(varCreatedVal);

int varietyValue = varNumCreated.intValue();

wdContext.currentContextElement().setVa_GeneratedVarietyId(varietyValue);