cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Search using java API

Former Member
0 Kudos

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];

wdComponentAPI.getMessageManager().reportSuccess("test4");

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

wdComponentAPI.getMessageManager().reportSuccess("test5");

//fields[1] = repositorySchema.getFieldId("Products", "Father's Name");

wdComponentAPI.getMessageManager().reportSuccess("test6");

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

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

//

//FieldSearchDimension fieldSearchDimension = new FieldSearchDimension(fields[1]);

//TextSearchConstraint textSearchConstraint = new TextSearchConstraint("prasanthi father", TextSearchConstraint.EQUALS);

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

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

//

Search search = new Search(tableId);

//search.addSearchItem(fieldSearchDimension, textSearchConstraint);

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);

Accepted Solutions (1)

Accepted Solutions (1)

Greg_Austin
Active Participant
0 Kudos

Your search code looks good to me. Take out the search constraint and verify you get data back. If that works verify sravan pulls back results in DataManager for the Name field.

-Greg

Edited by: Greg Austin on Feb 17, 2009 9:35 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

I am able to print the table id and field id also. But not able to retrieve the records.

Kindly suggest.