odataorg.github.io icon indicating copy to clipboard operation
odataorg.github.io copied to clipboard

Reference service OData lambda queries don't work

Open ideafixxxer opened this issue 1 year ago • 0 comments

Hello,

I’m trying to use OData reference service with OData ‘any’ function and getting errors consistently.

These examples

http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=AddressInfo/any(o:o/Address eq '87 Polk St. Suite 5') http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=Emails/any(o:o eq '[email protected]')

produce

{
    "error": {
        "code": "",
        "message": "Value cannot be null.\r\nParameter name: source"
    }
}

I cannot check if the collection itself is null

http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=Emails ne null

{
    "error": {
        "code": "",
        "message": "The operand for a binary operator 'NotEqual' is not a single value. Binary operators require both operands to be single values."
    }
}

If I use the lamda query from the collection http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/Me/Friends?$filter=Friends/any(f:f/FirstName eq 'Scott')

it doesn’t return an error, however it doesn’t seem to work correctly since none of the results have string “Scott” in them

{
    "@odata.context": "https://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/$metadata#People",
    "value": [
        {
            "UserName": "russellwhyte",
            "FirstName": "Russell",
            "LastName": "Whyte",
            "MiddleName": null,
            "Gender": "Male",
            "Age": null,
            "Emails": [
                "[email protected]",
                "[email protected]"
            ],
            "FavoriteFeature": "Feature1",
            "Features": [
                "Feature1",
                "Feature2"
            ],
            "AddressInfo": [
                {
                    "Address": "187 Suffolk Ln.",
                    "City": {
                        "Name": "Boise",
                        "CountryRegion": "United States",
                        "Region": "ID"
                    }
                }
            ],
            "HomeAddress": null
        },
        {
            "UserName": "ronaldmundy",
            "FirstName": "Ronald",
            "LastName": "Mundy",
            "MiddleName": null,
            "Gender": "Male",
            "Age": null,
            "Emails": [
                "[email protected]",
                "[email protected]"
            ],
            "FavoriteFeature": "Feature1",
            "Features": [],
            "AddressInfo": [
                {
                    "Address": "187 Suffolk Ln.",
                    "City": {
                        "Name": "Boise",
                        "CountryRegion": "United States",
                        "Region": "ID"
                    }
                }
            ],
            "HomeAddress": null
        }
    ]
}


ideafixxxer avatar Dec 04 '24 19:12 ideafixxxer