cancel
Showing results for 
Search instead for 
Did you mean: 

Missing record when retrieving leaf and non-leaf nodes from hierarchy table

Former Member
0 Kudos

Hi,

I got problem with retrieving leaf and non-leaf nodes from hierarchy table. Does anybody know the solution? Thanks.

There are two records with name "abc" in my hierarchy table. One "abc" is leaf node and another "abc" is non-leaf node in hierarchy view.

I tried to retrieve all two records of "abc" by calling MDM Java API "RetrieveLimitedRecordsCommand".

I got one record and missed another record.

The missing record is the non-leaf node in hierarchy view.

Here are some code:

RetrieveLimitedRecordsCommand retrieveLimitedRecsCmd = new RetrieveLimitedRecordsCommand(this.getConnectionPool());

retrieveLimitedRecsCmd.setSession(this.getUserSession());

Search search = new Search(searchTableId);

FieldSearchDimension searchDim = new FieldSearchDimension(searchFieldId);

TextSearchConstraint textConstraint = new TextSearchConstraint(searchValue, TextSearchConstraint.EQUALS);

search.addSearchItem(searchDim, textConstraint);

search.setComparisonOperator(Search.OR_OPERATOR);

retrieveLimitedRecsCmd.setSearch(search);

ResultDefinition resultDef = new ResultDefinition(tableId);

FieldId []a_searchFieldIds = ...........;

resultDef.setSelectFields(a_searchFieldIds);

resultDef.setFieldSelectionType(ResultDefinition.ALL_FIELDS);

retrieveLimitedRecsCmd.setResultDefinition(resultDef);

retrieveLimitedRecsCmd.execute();

RecordResultSet resultSet = retrieveLimitedRecsCmd.getRecords();

return resultSet.getRecords();

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You should <b>not</b> use RetrieveLimitedRecordsCommand to retrieve Hiearchy table records.

You should try using RetrieveLimitedHierTreeCommand or RetrieveLimitedHierChildrenCommand for Hiearchy Tables.

Former Member
0 Kudos

I just want to retrieve records from that table by passing "searchTable", "searchField" and "searchValue".

I don't have root RecordId or parent RecordId to pass to RetrieveLimitedHierTreeCommand or RetrieveLimitedHierChildrenCommand.

Former Member
0 Kudos

<b>Class RetrieveLimitedHierTreeCommand</b>

This command allows for retrieving the limited hierarchy tree based on the search criteria.

This class has a method

<b>void setSearch(Search search) </b>

where you can pass an instance of a Search class.

Former Member
0 Kudos

It works by using RetrieveLimitedHierTreeCommand for one repository. But it doesn't work for another repository

class HierResultSet exists in the SAP Java API, but looks like RetrieveLimitedHierTreeCommand doesn’t return HierResultSet. How to use HierResultSet?

Message was edited by:

Forrest Lin