This video is a tutorial on how to implement and use the filter query option in OData. The presenter provides a step-by-step guide on how to use the filter query option, including how to handle cases where the front-end user doesn’t pass the necessary zeros in the filter value.
Here’s a summary of the key points:
- Overview of Existing OData Service: The presenter begins by giving a brief overview of the existing OData service, which includes two entity types: sales order header and sales order item, and two entity sets: sales order headers and sales order items.
- Accessing Data from Sales Order Headers: The presenter explains how to get data from the sales order headers by passing the service name and the entity set name. The presenter also shows how to implement the order by clause, but notes that it won’t trigger without an order by clause being passed.
- Introduction to Filter Query Option: The presenter introduces the filter query option. To use this, you need to pass your host name, port name, Ico path, service name, entity set name, and then “$filter=” followed by the value you want to filter by.
- Using Symbols in Filter Query: The presenter explains that you can’t use sign symbols in the filter query because they are already being used elsewhere. Instead, you should use “EQ” for equals, “LE” for less than or equal to, “GE” for greater than or equal to, etc.
- Implementing the Filter in Code: The presenter shows how to implement the filter in the code. This involves using the “get filter” method from the “tech request context” object and then using the “get select options” method from the filter object.
- Handling Cases with Missing Zeros: The presenter explains how to handle cases where the front-end user doesn’t pass the necessary zeros in the filter value. This involves using the “convert select option” method from the filter object to add the necessary zeros.
- Passing Multiple Values in Filter Query: The presenter demonstrates how to pass multiple values in a filter query. This involves using brackets and the “and” or “or” operators.