Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm calling listdata.svc a few times with different URL's depending in what is selected, I have some issues with the parameters/filters.

First URL:

var listUrl = siteUrl + "_vti_bin/ListData.svc/Pages?$filter=ApprovalStatus eq '0'&top=2&orderby=Modified desc";

This one only get items that are approved but it ignores the top and orderby, what am I doing wrong here? I've tried with various combos of moving the parameters around ,use &$ etc.

Second URL:

var listUrl = siteUrl + "_vti_bin/ListData.svc/Pages?$filter=substringof('" + keyword + "',Keywords)";

This one works but I can't get it to only get items with the keywords AND are published, ordered by Modified.

Third URL:

var listUrl = siteUrl + "_vti_bin/ListData.svc/Pages?$filter=ApprovalStatus eq '0'&$skip=" + displayedItems + "&top=1";

This one get only approved items but ignores skip and top.

Any suggestions?

Thanks in advance.\

Update: Looks like:

$.getJSON(listUrl,
            function (data) {
                $.each(data.d.results,
                function (i, result) {

causes the error when I use &$top in the URL..

Edit2: Ok so when I use top I have to do $.each(data.d, instead of $.each(data.d.result,

share|improve this question
    
Most of your parameters are missing $: $orderby, $skip, $top –  Per Jakobsen Oct 2 '12 at 7:34
    
updated my post with another url –  John Oct 3 '12 at 1:16

1 Answer 1

up vote 0 down vote accepted

To get information order by a parameter and filtered with a specify word you can do something like this:

http://contoso/sites/sharepointlist/_vti_bin/listdata.svc/InventoryLocations()
     ?$filter=startswith(Part/SKU,'sku')
     &$orderby=Part/SKU
     &$expand=Part
     &$select=BinNumber,Quantity,Title,Id,PartId,Part/SKU,Part/Title

this is an example that I got from MSDN and I used it for my purpose and it works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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