Skip to content

How to filter nested List #15

Description

@BluePalmTree

Hello,

I have a question, how can you filter by a property in a nested list? For example:

public class Receipt
{
       public Guid Id {get;set;}
       public string ReceiptNo {get;set;}
       public List<ReceiptPositon> Positions {get;set;}
}

public class ReceiptPosition
{
     public Guid ReceiptId {get;set;}
     public int ProductCount {get;set;}
}

Now I want to find all Receipts where a Positions has a ProductCount greater than 2. I tried doing something like this:

$filter=Positions/ProductCount gt 2

With debugging I found out that this doesn't work because Positions is a List and a List doesn't have the property ProductCount. How would the correct Syntax be?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions