cancel
Showing results for 
Search instead for 
Did you mean: 

Range search

former_member206107
Active Participant
0 Kudos

Hi,

There is a field in the main table say "Number" - type integer.

The values are 1,2...10.

Now I want to retrive the values from 4 to 8.

Here is my code where i am using numeric search constraint to achive my scenario

MainTableSearch.addSearchItem(new FieldSearchDimension(MDM_MainTable_Filter_FId[6]), new NumericSearchConstraint(iAutoID_From,NumericSearchConstraint.GREATER_THAN_OR_EQUAL_TO));

MainTableSearch.addSearchItem(new FieldSearchDimension MDM_MainTable_Filter_FId[6]), new NumericSearchConstraint(iAutoID_To,NumericSearchConstraint.LESS_THAN_OR_EQUAL_TO));

But from the code you can clearly see that it will give me 1,2,3,4 for the first condition (Lesser than or equal to) and 4,5,6...10 for the secod condition (Greater than or equal to).

I am adding these two search item to the same search object.

How can i combine these two conditions to get values from 4 to 8?

Best regards,

Arun prabhu S

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member206107
Active Participant
0 Kudos

Many thanks to Walter.

Range search is working from SP06 patch 01 with some limitations on Create stamp (Date time) range search.

Cheers,

Arun prabhu S

former_member206107
Active Participant
0 Kudos

Hi Walter,

The range search is not working for AutoId field.

Exception - "Search group nesting is currently not supported."

I have furnished my code below...

Please let me know if some thing is wrong in my code.

Search MainTableSearch = null;

MainTableSearch = new Search(MainTable_ID);

SearchGroup AutoIDSearch_Grp = new SearchGroup();

AutoIDSearch_Grp.addSearchItem(new FieldSearchDimension MDM_MainTable_Filter_FId[6]),new NumericSearchConstraint( intAutoID_From,

NumericSearchConstraint.GREATER_THAN_OR_EQUAL_TO));

AutoIDSearch_Grp.addSearchItem(new FieldSearchDimension MDM_MainTable_Filter_FId[6]),new NumericSearchConstraint( intAutoID_To,

NumericSearchConstraint.LESS_THAN_OR_EQUAL_TO));

AutoIDSearch_Grp.setComparisonOperator(AutoIDSearch_Grp.AND_OPERATOR);

MainTableSearch.addSearchItem(AutoIDSearch_Grp);

Cheers,

Prabhu

former_member206107
Active Participant
0 Kudos

Hi Walter,

I tried the search group for field type text.

I am getting the following exception

java.lang.UnsupportedOperationException: Search group nesting is currently not supported.

Best regards,

Arun prabhu S

Former Member
0 Kudos

Hi Arun,

You are probably using a version of MDM which didn't yet have support for SearchGroups. I am not sure if it is supported in the SP6 Patch 1 release available in the Marketplace (you are welcome to try), but it is definitely supported in the upcoming Patch 2 release.

Walter

Former Member
0 Kudos

By the way... did the SearchGroup work with numeric search?

Walter

former_member206107
Active Participant
0 Kudos

Hi Walter,

Thanks a lot!

Is the search using search group applicable for field type - text?

field values: a,b,c,d....z

I want to retrive records from d to k.

What would be the possible solution for this?

Can i use textsearchconstraint with KeywordSearchConstraint.EQUALS? for both search group item and apply or_operator?

Sample code will be more useful.

Best regards,

Arun prabhu S

Former Member
0 Kudos

Hi Arun,

The latest versions of the MDM Java API include support for SearchGroup, so you can achieve what you want by doing the following:

1) Create a Search

2) Create a SearchGroup

3) Use the method searchGroup.addSearchItem(...) to add your two search items.

4) Use the method searchGroup.setComparisonOperator(...) to choose between and or or search.

5) Add the SearchGroup to the Search : search.addSearchItem( yourSearchGroup )

VERY IMPORTANT

Note that SearchGroups can be nested to one level only. i.e. You can add a SearchGroup to a Search, but you cannot add a SearchGroup to another SearchGroup, even though the software design does not prevent you from doing this. Attempting more than one level of SearchGroup nesting will result in run-time exceptions.

Happy programming,

Walter