Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #850

Open
ertugrulkaya opened this issue Apr 11, 2023 · 6 comments
Open

Documentation #850

ertugrulkaya opened this issue Apr 11, 2023 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@ertugrulkaya
Copy link

Hi ,

Could you please add an example or documentation about how use advancedFilter logic??

@iammukeshm iammukeshm added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 12, 2023
@iammukeshm iammukeshm self-assigned this Apr 12, 2023
@ertugrulkaya
Copy link
Author

ertugrulkaya commented Apr 24, 2023

if you want you can show me with in 30 min, then i can prepare document for you.

then you can upload it into web page. @iammukeshm

@parthvnp
Copy link

parthvnp commented May 9, 2023

@iammukeshm I can work on adding an example to documentation.

@ertugrulkaya
Copy link
Author

Any update?

@parthvnp
Copy link

@ertugrulkaya Will have it ready by tomorrow.

@parthvnp
Copy link

parthvnp commented May 19, 2023

@ertugrulkaya Here is a simple example with AdvancedFilter logic. We will apply this logic to api/v1/products/export endpoint as this is one of the endpoint that accepts advancedFilter argument in post request body. First, create a product using api/v1/products. Ensure that the brandId you pass to the request body exists in the database table Catalog.Brands. Suppose you named this new Product Cool Product and would like to search for the Product using it's name instead of it's Id. Then you would pass the following advancedFilter query in the post request to api/v1/products/export to export an Excel Sheet containing this product (if it exists in the database).

{
  "advancedFilter": {
    "field": "Name",
    "operator": "eq",
    "value": "Cool Product"
  },
  "brandId": "<replace with brand id you used to create the product>"
}

Similarly, you can pass other variants of advanced filter by combining various operators with values for a field. The supported operators are :

public static class FilterOperator
{
    public const string EQ = "eq";
    public const string NEQ = "neq";
    public const string LT = "lt";
    public const string LTE = "lte";
    public const string GT = "gt";
    public const string GTE = "gte";
    public const string STARTSWITH = "startswith";
    public const string ENDSWITH = "endswith";
    public const string CONTAINS = "contains";
}

Note that FilterOperator's use is restricted to field that support the operator. For instance, the startswith operator cannot be combined with a numeric value. If you want any more examples, please let me know.

@learnwithkawsar
Copy link

Hello @parthvnp
What about other properties in base-filter like logic ,filters . can you please give a multiple-column searching using advancedFilter.

"advancedFilter": {
"logic": "string",
"filters": [
"string"
],
"field": "string",
"operator": "string",
"value": "string"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants