admin管理员组文章数量:1313347
Our application is using Kendo for UI, for fetching Data from backend it is using filter operators. now I want to fetch data with complex filter as in the below code, I want to filter for the DueDate field >= condition and other thing is, it should be complex like the condition is "TaskGroupStatus is Pending or Rejected and DueDate field >= CurrentDate", like in 3 paramters 2 should be with or condition and 3rd parameter is applied as and on top of the other paramters, how to frame this filter in the below code? Is it possible, need some help. Thank you so much
DataQueryParameters queryParameters = new DataQueryParameters();
queryParameters.Filter = new Filter()
{
Logic = "or",
Filters = new List<Filter>()
{
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Pending
},
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Rejected
},
new Filter()
{
Field = "DueDate",
Operator = "gte",
Value = (int)TaskGroupStatus.Pending
}
}
};
Our application is using Kendo for UI, for fetching Data from backend it is using filter operators. now I want to fetch data with complex filter as in the below code, I want to filter for the DueDate field >= condition and other thing is, it should be complex like the condition is "TaskGroupStatus is Pending or Rejected and DueDate field >= CurrentDate", like in 3 paramters 2 should be with or condition and 3rd parameter is applied as and on top of the other paramters, how to frame this filter in the below code? Is it possible, need some help. Thank you so much
DataQueryParameters queryParameters = new DataQueryParameters();
queryParameters.Filter = new Filter()
{
Logic = "or",
Filters = new List<Filter>()
{
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Pending
},
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Rejected
},
new Filter()
{
Field = "DueDate",
Operator = "gte",
Value = (int)TaskGroupStatus.Pending
}
}
};
Share
Improve this question
edited Jan 30 at 22:08
AbdulAleem
asked Jan 30 at 20:09
AbdulAleemAbdulAleem
6310 bronze badges
1 Answer
Reset to default 1Filters can be nested. If you want "(TaskGroupStatus is Pending or Rejected) and DueDate field >= CurrentDate", your top level logic is "and" with the first filter having the two nested filters with logic as "or".
DataQueryParameters queryParameters = new DataQueryParameters();
queryParameters.Filter = new Filter()
{
Logic = "and",
Filters = new List<Filter>()
{
new Filter()
{
Logic = "or",
Filters = new List<Filter>()
{
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Pending
},
new Filter()
{
Field = "TaskGroupStatus",
Operator = "eq",
Value = (int)TaskGroupStatus.Rejected
}
}
},
new Filter()
{
Field = "DueDate",
Operator = "gte",
Value = (int)TaskGroupStatus.Pending
}
}
};
本文标签: cKendo operators for Complex logic mix of lt or gt and combiningStack Overflow
版权声明:本文标题:c# - Kendo operators for Complex logic mix of <= or >= and combining - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741938198a2405981.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论