在Odata查询的$ expand中使用$ filter [英] using the $filter inside the $expand in the Odata query
本文介绍了在Odata查询的$ expand中使用$ filter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Odata查询之类的扩展实体来使用过滤器
I am trying to use the filter in the expanded entity using the Odata query like
https://labstest.science.com/DEV/odata/ROOM_REQUEST?$expand=REQ_COLONYROOM($select=Name;$filter=Name eq 'RB05')
这部分起作用.对于名称不等于RB05的REQ_COLONYROOM,它将所有ROOM_REQUEST带空值
This works partially. It brings all the ROOM_REQUEST with Null for the REQ_COLONYROOM where Name is not equal to RB05
{
"@odata.context": "https://labstest.science.com/DEV/odata/$metadata#ROOM_REQUEST(REQ_COLONYROOM(Name))",
"value": [
{
"Id": 18399308,
"Name": "M1",
"Barcode": "M1",
"REQ_COLONYROOM": null
},
{
"Id": 18403071,
"Name": "M2",
"Barcode": "M2",
"REQ_COLONYROOM": {
"@odata.id": "https://labstest.science.com/odata/COLONY_ROOM('MC19')",
"Name": "RB05"
}
},
{
"Id": 18403109,
"Name": "M3",
"Barcode": "M3",
"REQ_COLONYROOM": null
}]}
尽管M1和M3与RB05具有不同的菌落,但它通过odata调用返回Null
Though M1 and M3 has different Colony than RB05 it returns Null with the odata call
推荐答案
您是否尝试过以下方法:
Did you try something like this:
https://labstest.science.com/DEV/odata/ROOM_REQUEST?$expand=REQ_COLONYROOM&$select=REQ_COLONYROOM/Name&$filter=REQ_COLONYROOM/Name eq 'RB05'
我认为没有SELECT就足够了
I think it would be enough not having SELECT:
https://labstest.science.com/DEV/odata/ROOM_REQUEST?$expand=REQ_COLONYROOM&$filter=REQ_COLONYROOM/Name eq 'RB05'
这篇关于在Odata查询的$ expand中使用$ filter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文