This is a migrated thread and some comments may be shown as answers.

OData filter with logical or operator

2 Answers 195 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 18 Jun 2012, 03:19 PM
I have been unable to find in the documentation how to add multiple filters with logical or instead of and.  Here is my code which results in a query like this:

filter=(SubscriptionId+eq+0+and+SubscriptionId+eq+472) 

what I want is this:

filter=(SubscriptionId+eq+0+or+SubscriptionId+eq+472) 

Is there any way to do this?

$("#ambulation2").kendoDropDownList({
            dataTextField: "Ambulation",
            dataValueField: "AmbulationId",
            dataSource: {
                type: "odata",
                serverFiltering: true,
                transport: {
                    read: "/yglservice.svc/RefAmbulations",
                    dataType: 'jsonp',
                    cache: true                   
                },
                filter: [{
                        field: "SubscriptionId",
                        operator: "eq",
                        value: 0
                },{
                    field: "SubscriptionId",
                    operator: "eq",
                    value: @UserInfo.SubscriptionId.ToString()
                }]
            }
        });

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 18 Jun 2012, 03:39 PM
Hello Gary,

Here is how you can achieve this:
http://jsfiddle.net/rusev/RsYcQ/

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gary
Top achievements
Rank 1
answered on 18 Jun 2012, 03:46 PM
Thanks for the fast reply!  That works perfectly.
Tags
Data Source
Asked by
Gary
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Gary
Top achievements
Rank 1
Share this question
or