Skip to Content
0
Former Member
Feb 17, 2009 at 09:07 AM

search using java API

17 Views

Hi,

I am using the below code to search in MDM table. But i am not getting the records.

Kindly suggest.

repositorySchema = getRepositorySchemaCommand.getRepositorySchema();

TableId tableId= repositorySchema.getTable("Products").getId();

wdComponentAPI.getMessageManager().reportSuccess(""+tableId);

FieldId[] fields = new FieldId[1];

fields[0] = repositorySchema.getFieldId("Products", "Name");

wdComponentAPI.getMessageManager().reportSuccess(""+fields[0]);

FieldSearchDimension fieldSearchDimension1 = new FieldSearchDimension(fields[0]);

TextSearchConstraint textSearchConstraint1 = new TextSearchConstraint("name",TextSearchConstraint.EQUALS);

Search search = new Search(tableId);

search.addSearchItem(fieldSearchDimension1, textSearchConstraint1);

ResultDefinition rd = new ResultDefinition(tableId);

rd.setSelectFields(fields);

RetrieveLimitedRecordsCommand retrieveLimitedRecordsCommand = new RetrieveLimitedRecordsCommand(simpleConnection);

retrieveLimitedRecordsCommand.setSession(authenticateUserSessionCmd.getSession());

retrieveLimitedRecordsCommand.setResultDefinition(rd);

retrieveLimitedRecordsCommand.setSearch(search);

retrieveLimitedRecordsCommand.execute();

totalRecord = retrieveLimitedRecordsCommand.getRecords().getCount();

wdComponentAPI.getMessageManager().reportSuccess("records are"+totalRecord);

Edited by: jyothi beera on Feb 17, 2009 10:07 AM

Edited by: jyothi beera on Feb 17, 2009 10:08 AM