on 03-09-2016 5:50 PM
Hello MDM experts,
In SAP MDM SP15 there is a new method for filtering tuple values called: "setFilterTupleValues".
In this method i need to create an object of type FilterTupleValues passing the following parameters in class constructor:
FilterTupleValues filterTupleValues = new FilterTupleValues(tupleSearch, tuplePath, searchResultSettings, property);
I need some help on how create the first parameter: tupleSearch
My requirement is prevent a person from modifying some lines of a MultiTupleValue field.
For example, only lines (tuples) where the field code starts with a prefix "Z".
So in this case i know that other parameters are:
searchResultSettings: SearchResultsProperty.MODIFY_SEARCH_RESULTS
property: Boolean.False
Can someone give me an example or piece of code?
Thanks in advance!
Reinert.
Hello,
The following code snippet can help, if somebody need in the future...:
public void 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 Tuple member field (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:
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();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.