on 02-17-2009 9:06 AM
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);
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am able to print the table id and field id also. But not able to retrieve the records.
Kindly suggest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.