Closed harpsicord86 closed 4 years ago
I think I've finally solved it...
In my MailoutViewModel, I was using IEnumerable
Thanks anyway :-) this is a great library and I'm looking forward to using it in my project.
In my MailoutViewModel, I was using IEnumerable instead of List. Because of using an interface, it could not find the property within the list.
Thanks @harpsicord86 , that was my issue as well! Thank you for commenting your solution and not leave the thread without an answer
Hi there,
I'm having an issue with trying to implement a filter on a nested collection. I have the following ViewModel set up:
`public class MailoutViewModel { private int MailoutTotal => Mailouts.Count(); private int ResponseTotal => Responses.Count();
}`
I'm using this so that I can query several tables to check if a participant has a mailout due e.g. if they have a particular response but no letter has been sent then we can send them a specific letter.
I've implemented as such: ` var searchFilterTest = new QueryBuilderFilterRule() { Condition = "and", Rules = new List()
{
new QueryBuilderFilterRule()
{
Condition = "and",
Field = "HaveAnyMailouts",
Id = "HaveAnyMailouts",
Operator = "equal",
Type = "boolean",
Value = new [] { "true" }
},
new QueryBuilderFilterRule()
{
Condition = "and",
Field = "HaveAnyResponses",
Id = "HaveAnyResponses",
Operator = "equal",
Type = "boolean",
Value = new [] { "true" }
},
new QueryBuilderFilterRule()
{
Condition = "and",
Id = "Responses.Ambiguous",
Field = "Responses.Ambiguous",
Input = "NA",
Operator = "equal",
Type = "boolean",
Value = new[] {"false"}
}
}
};
var result = mailouts.BuildQuery(searchFilterTest).ToList(); ` However, upon building the query, I'm getting a System.ArgumentNullException: 'Value cannot be null. Parameter name: property'
Here is my Response class: `public class Response : BaseEntity { public Response() { ResponseItems = new List();
}
I've been following your example within your Unit Test but it doesn't seem to work (also it's worth noting that in your unit test, you are using FilterRule which has been marked as deprecated!).
Can someone offer any advice please?