cancel
Showing results for 
Search instead for 
Did you mean: 

java API :'OR' operator on lookup parameters not working in SP1

Former Member
0 Kudos

Hi all,

We are using API version 5.5.15.09. (SP1) on MDM server SP1 as well.

We experience a problem when using java API:

when we create a search object and add lookup parameters on 2 fields with the 'OR' operator (GlobalOrSearchCombinationType), no result is returned.

The same code is working on String parameters

The code sample is:

Search search = new Search();

search.SetSearchTable("Products");

SearchParameters searchParam = search.GetParameters();

search.SetSearchType(Search.GlobalOrSearchCombinationType);

String fieldName1 = "GroupType1";

int recordID1 = 51;

LookupParameter lookupParam = searchParam.NewLookupParameter("Products",fieldName1);

lookupParam.Add(recordID1);

String fieldName2 = "GroupType2";

int recordID2 = 52;

LookupParameter lookupParam = searchParam.NewLookupParameter("Products",fieldName2);

lookupParam.Add(recordID2);

We expect to get all products belonging to GroupType1 OR GroupType2 but we get products belonging to GroupType1 AND GroupType2 which can be 0 product

thanks for your help

Nicolas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Nicolas,

The code given below is working in MDM5.5 (SP2), I am not sure about SP1. Hope it helps.

String fieldName1 = "GroupType1";

int recordID1 = 51;

LookupParameter lookupParam = searchParam.NewLookupParameter("Products",fieldName1);

lookupParam.Add(recordID1);

//Set OR condition here

lookupParam.SetSearchOperator(LookupParameter.SEARCH_OPERATOR_OR);

String fieldName2 = "GroupType2";

int recordID2 = 52;

LookupParameter lookupParam = searchParam.NewLookupParameter("Products",fieldName2);

lookupParam.Add(recordID2);

Regards,

Ananth

Former Member
0 Kudos

Hi Ananth and first of all thanks for your help,

unfortunately it does not solve our issue.

Let me give you more information:

the 'OR' we want to apply is not on the lookupParameter but on the search itself. That is why we use the search.SetSearchType(int) method.

In addition, this search.SetSearchType(int) method works perfectly when the search object only contains String parameters.

Would it be possible that the search.SetSearchType(int) method is not working for all parameter types?

thanks again

Nicolas