4

I'm trying to filter a lookup column on my list using rest this is the column on my list enter image description here

it's a look up (connected to another list)

and my rest on the list enter image description here My query should get all the items that are equal to 4

also my column name in the list is _x05d0__x05d6__x05d5__x05e8_ and when I did the rest query the column name was _x05d0__x05d6__x05d5__x05e8_Id

*the column names aren't in english and yes I know that english is the best option when creating columns but it wasn't me, it's an old list.

1

To filter lookup columns you have to use expand and filter properties. First mention the property in select statement and expand then apply filter

Use Ajax Get Request,


var select = "$select=normalCol1,lookUpCol/Title,lookUpCol/Id&";

var expand = "$expand=lookUpCol/Id&";

var filter = "$filter=lookUpCol/Id eq 4";

var url = _sppagecontextinfo.webAbsoluteUrl + "/_api/web/lists/getbytitle(list title)/items?"+select+expand +filter ;***

$.ajax({
url:url,
type:"GET"
headers :{"Accept": "application/json;odata:verbose"}
}).then(successHandler,errorHandler)
  • Thanks for the help!! I guees I missed something when I wrote the query.I dii it like you explained with select,expand and filter variables. – SharonG Jul 20 '17 at 14:00
1

Use this rest query

/_api/web/lists/getbytitle(list title)/items?$expand=lookUpCol/Id&$filter=lookUpCol/Id eq 4

It should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.