On SharePoint 2013 On Premise, I need rest api filter where I can search some numbers in list starts with. Since records are around 100,000 I can not display all. Hence need a kind of search function.
You can use the filter on column something like given below:
var endpointUri = appwebUrl + "/_api/web/lists/getbytitle('listName')/items?$select=*&$filter=startswith(Title,'value')";
-
-
You can use it on number field too.... Just add the internal name of your number field replacing 'Title' and the number you want to search replacing 'value' in above example. – Ganesh Sanap Aug 28 '18 at 18:24
-
Is it a numberfield or a textfield?
If its a numberfield why not create a filter that compares a number greater than the numberfield?
Something like this:
/_api/web/lists/getbytitle('list')/items?$filter=[Numberfield] ge 123000
Where ge is Greater than or equal.
-
I think Vikas wants to search the number starting with 123xxx. Not the values greater than that 123xxx. – Ganesh Sanap Aug 28 '18 at 13:26
-
Yeah but as he writes numberfield and not text field I dont really know what he means. He need to clarify if its a number or a textstring he want to search for. – Johan Brännmar Aug 28 '18 at 13:28
-
-
You cant cast a number value in SharePoints REST api and therefore not use startswith so i think your only valid option is to use my method where you look for number bigger than the one you are looking for. – Johan Brännmar Aug 28 '18 at 15:17
You can try something like below:
e.g. To get item with the number 444
in numberfield
:
/_api/web/lists/getbytitle('testCRUD')/items?$select=*&$filter=(numberfield ge '444') and (numberfield le '444')
startswith
on String and not the number. Refer this link - docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/… – Rohit Waghela Aug 28 '18 at 17:30Ge
andLe
(i.e. greater than equal to and less than equal to) to get the required result. – Rohit Waghela Aug 28 '18 at 17:33