Sieve icon indicating copy to clipboard operation
Sieve copied to clipboard

Filtering or sorting when I used join in query

Open Patryxus opened this issue 4 years ago • 1 comments

Hi! I cannot find how can I define filters and sorts when some of them are from entity A, some of them from Entity B? I have more complex queries with joins, left joins (I thinks most of us use more sophisticated queries in reality). Is there any possibility to use your library for that? I add that sometimes there is no navigation properties. Another issue is: can I somehow change filters or sorts from the SieveModel (remove some, add another one) ? If I only can modify a list of FilterTerm and used such changed SieveModel but I cannot see how to create SieveModel based on list of FilterTerm or SortTerm. It would be great if I can check which entity has a given property (GetFiltersParsed and use some your methids) and then divide it into groups and apply step by step. Unfortunately now I get en error when property isn't defined in entity ;(. I regret that in methods ISieveCustomFilterMethods I don't have as parametr the filter object FilterTerm, because now I have to manually check op, values and create my own FilterTerm again (you can methods based on FilterTerm). Any clues? Thanks in advanced.

Patryxus avatar Jun 27 '20 08:06 Patryxus

I have the same sort of issue, for example this is the model:

{
  "ID": 12345,
  "SomeProperty": "SomeValue",
  "AnArrayOfValues": [
    {
      "Key": "2020",
      "Amount": 1234
    },
    {
      "Key": "2021",
      "Amount": 12345
    },
    {
      "Key": "2020Q1",
      "Amount": 123
    },
    {
      "Key": "2020Q2",
      "Amount": 111
    },
    {
      "Key": "2020M1",
      "Amount": 12
    },
    {
      "Key": "2020M2",
      "Amount": 12
    }
  ]
}

I want to sort on the Key and Amount properties of the AnArrayOfValues property, for example order by the Amount belonging to the Key 2020

stefankip avatar Oct 14 '20 08:10 stefankip