light-odata icon indicating copy to clipboard operation
light-odata copied to clipboard

Feature Request: Enhance ODataFilter Class to Support OR Operator with Functions

Open michaelschoenbaechler opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently, it seems like the ODataFilter class doesn't support the usage of OR operators between different functions, which limits the filtering capabilities, especially when I want to perform string searches across multiple properties.

Describe the solution you'd like

I propose an enhancement in the ODataFilter class to support the OR operator between functions, making it possible to search a string in multiple properties simultaneously. This can be done by extending the existing methods or creating new methods to accommodate this functionality. The goal is to enable queries that look like this:

// Query should be able to support filters like:
// "substringof('test', CompanyName) eq true or substringof('test', CompanyDescription)"
OData
  .newFilter()
  .property("substringof('test', CompanyName)").eq(true)
  .or()
  .property("substringof('test', CompanyDescription)").eq(true)
  .build();

Describe alternatives you've considered

An alternative could be writing a custom function to handle these types of queries outside of the ODataFilter class. However, integrating this feature directly into the ODataFilter class would provide a more streamlined and native experience for the users.

Additional context

This feature enhancement would improve the flexibility and capabilities of the ODataFilter class, allowing for more complex and nuanced queries, especially when dealing with string searches across different properties.

michaelschoenbaechler avatar Sep 04 '23 20:09 michaelschoenbaechler

sure, I'll check this later

Soontao avatar Sep 06 '23 12:09 Soontao

Hi @Soontao, any progress on this?

phelipealves avatar Jul 23 '24 21:07 phelipealves