0

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.

  • Do you need to filter on single column values...is that right? – Ganesh Sanap Aug 28 '18 at 13:04
  • yes. There is only one number field. I want to search number 123xxx – Vikas Sharma Aug 28 '18 at 13:07
  • I have added the example in answer section for Title field. similarly you can do for your field. if useful, please up vote. :) – Ganesh Sanap Aug 28 '18 at 13:12
  • You can use 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:30
  • The work around is you can combine Ge and Le (i.e. greater than equal to and less than equal to) to get the required result. – Rohit Waghela Aug 28 '18 at 17:33
0

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')";
  • I want it on a number field – Vikas Sharma Aug 28 '18 at 14:13
  • 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
  • have you tried this? – Ganesh Sanap Nov 15 '18 at 12:51
0

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
  • I want to search number startswith 123... not greater than – Vikas Sharma Aug 28 '18 at 14:14
  • 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
0

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')

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.