cancel
Showing results for 
Search instead for 
Did you mean: 

Logical OR of QueryFilter.

Former Member
0 Kudos

I'm using NW CE EHP1 to model a find operation of a Business Object.

Can I select instances using 2 filters on 2 different attributes, in a logical OR?

For example, find the employees whose firstName starts by "A" OR whose lastName starts by "A".

If yes, how?

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can implement this condition usng findByMultipleParameters method and QueryFilter.OR Condition.

You have to create a QueryFilter list. Then add your individual filters to this list. Beteen filters you can add AND or OR constants to the list. But the problem is that These constants are deprecated.

Any way refer this [Java Docs |https://www.sdn.sap.com/irj/sdn/javadocs]for QueryFiler and QueryFilterFactory.

Thanks

Former Member
0 Kudos

Sampath,

thank you for your helpful answer. I read also your wiki, which is so clear and helpful.

I looked at the javadoc, but unfortunally the explanations in it are almost completely missing.

Nevertheless the javadoc (class QueryFilter, method setOperation) says that "direct use of the findByMultipleParameter operation is discouraged".

I suppose that an alternative should exist. Have you any idea?

Where can I find some more information?

Thank you for your help.