Hello,
The following code snippet can help, if somebody need in the future...:
publicvoid runTupleSearchHideResults( ) {
//getting session context and repository schema:
UserSessionContext context = this._repositoryBean.getUserSessionContext();
RepositorySchemaEx repositorySchema = MetadataManager.getInstance().getRepositorySchema(context);
//get the table id the result set is working on
TableId mainTableId = repositorySchema.getTableId("Products");
//get from the schema the field id (in this case it’s a tuple) in the main table – (See img_1.png)
FieldId fieldId = repositorySchema.getFieldId("Products", "Address_old_code");
//get the Tuplememberfield (Address\ADD_TY) Id you want to have the search run on (See img_2.png)
FieldId tupleFieldId = repositorySchema.getTupleMemberField("Address", "ADD_TY").getId();
//get the record id in the record set which its tuple you want to limit (See img_3.png)
RecordId recordId = new RecordId(1364);
//build your search – no need to run it – the user exit will run the search and will act on the search results
//in this case – building the search to get all the records where the address type (ADD_TY) starts with t.
TupleSearch search = new TupleSearch(mainTableId, fieldId, recordId);
SearchDimension dim = new FieldSearchDimension(tupleFieldId);
SearchConstraint cons = new TextSearchConstraint("t", TextSearchConstraint.STARTS_WITH);
search.addSearchItem(dim, cons);
//build the path to the tuple (in this case, first lvl tuple, so only the tuple name needs to be here)
String[] tupleMemberPaths = new String[1];
tupleMemberPaths[0] = new String("Address_old_code");
//create a new instance of FilterTupleValues, providng the constructor 3 objects:
//1. The search object constructed earlier
//2. The tuple path (string array)
//3. The action type to apply on the search results (this will happen inside the user exit)
// THIS CAN BE ONE OF the following 2:
- 1. SearchResultsProperty.VIEW_SEARCH_RESULTS - to hide from the tuple the results of the search
- 2. SearchResultsProperty.MODIFY_SEARCH_RESULTS – to disable the option of editing the search results
FilterTupleValues filterTupleValues = new FilterTupleValues(search, tupleMemberPaths, SearchResultsLayoutProperties.SearchResultsProperty.MODIFY_SEARCH_RESULTS, false);
//call the user exit providing it the FilterTupleValues instance
wdThis.wdGetItemDetailsInterface().setFilterTupleValues(filterTupleValues);
//refresh the itemdetails
wdThis.wdGetItemDetailsInterface().refreshComponent();
}