cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve records having same value using MDM Java API

Former Member
0 Kudos

Hi,

I am using the MDM Java APIs in my WebDynpro component to retrieve the records from the MDM Repository. The Java API version is 5.5.63.60

I have a product table and it has several records with same product name. If I use the 'RetrieveRecordsByValueCommand', I get only one record i.e., the first encountered record that matches the product name. But, I want to retrieve all the records having the same product name.

What is the retrieveCommand that I can use to retrieve all the records with the same value for a given field?

With Regards,

Yuvaraj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Look at simple example:


        ResultDefinition rd = new ResultDefinition(tblCEMP);
        rd.setSelectFields(new FieldId[]{tblCEMP.BRANCHES, tblCEMP.FULL_NAME, tblCEMP.MAIL});

        Search srch = new Search(tblCEMP);
        SearchDimension sd = new FieldSearchDimension(tblCEMP.FULL_NAME);
        SearchConstraint sc = new TextSearchConstraint(strSearch, TextSearchConstraint.EQUALS);
        srch.addSearchItem(new SearchParameter(sd, sc));

        RetrieveLimitedRecordsCommand cmd = new RetrieveLimitedRecordsCommand(gate.getPool());
        cmd.setResultDefinition(rd);
        cmd.setSearch(srch);
        cmd.setSession(gate.getUsrSessionId());
        cmd.setPageSize(1);
        cmd.execute();
        cmd.setPageSize(cmd.getSearchTableMatchCount());
        cmd.execute();

        RecordResultSet recs = cmd.getRecords();

tblCEMP and gate it's my own objects not from Java API

Former Member
0 Kudos

Thanks Mike & Greg,

I am able to retreive the necessary records by RetrieveLimitedRecordsCommand with 'Search'.

But, does this mean that with the RetrieveRecordsByValueCommand, we can retrieve only one record?

Thanks again,

Yuvaraj SG

Greg_Austin
Active Participant
0 Kudos

The JavaDocs say that RertieveRecordsByValueCommand works best on a field that has a unique field value. If there are multiple matches the record selected is indeterministic.

Answers (1)

Answers (1)

Greg_Austin
Active Participant
0 Kudos

Use the RetrieveLimitedRecordsCommand.