dotnet-starter-kit icon indicating copy to clipboard operation
dotnet-starter-kit copied to clipboard

Documentation

Open ertugrulkaya opened this issue 2 years ago • 6 comments

Hi ,

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

ertugrulkaya avatar Apr 11 '23 21:04 ertugrulkaya

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

ertugrulkaya avatar Apr 24 '23 14:04 ertugrulkaya

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

parthvnp avatar May 09 '23 02:05 parthvnp

Any update?

ertugrulkaya avatar May 18 '23 16:05 ertugrulkaya

@ertugrulkaya Will have it ready by tomorrow.

parthvnp avatar May 18 '23 17:05 parthvnp

@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.

parthvnp avatar May 19 '23 05:05 parthvnp

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" },

learnwithkawsar avatar Sep 10 '23 18:09 learnwithkawsar