I have an ODATA query that pulls the first record from the Dynamics AX table and ignores the $filter clause when the $top parameter is the first parameter. However, it pulls the correct record for the $filter clause when the $top parameter is at the end of the query.
Question: How do I make the OData server honor the full query no matter where the $top parameter is placed?
the following two cases return identical results:
Case 1: https://url/data/Users?$top=1
{
"@odata.context":"https://url/data/$metadata#Users","value":[
{
"@odata.etag":"W/\"J5zEx4NDg33OD2YyM4TEs5NTY6zNz7E0ND7U3Nic=\"",
"Id":"first_user_in_the_table",
"Alias":"first_user_in_the_table@domain.com",
"Name":"first_user_in_the_table"
}
]
}
Case 2: https://url/data/Users?$top=1&$filter=Alias%20eq%20%27specific_user@domain.com%27
{
"@odata.context":"https://url/data/$metadata#Users","value":[
{
"@odata.etag":"W/\"J5zEx4NDg33OD2YyM4TEs5NTY6zNz7E0ND7U3Nic=\"",
"Id":"first_user_in_the_table",
"Alias":"first_user_in_the_table@domain.com",
"Name":"first_user_in_the_table"
}
]
}
However, when I move the $top parameter to the end of the query string I get the correct result.
Case 3: https://url/data/Users?$filter=Alias%20eq%20%27specific_user@domain.com%27&$top=1
{
"@odata.context":"https://url/data/$metadata#Users","value":[
{
"@odata.etag":"W/\"Jz3kz4Nj5g2N6zcz7MCw81Nj9M3M2TU3w4NT4c54Jw==\"",
"Id":"specific_user",
"Alias":"specific_user@domain.com",
"Name":"The Specific User I Actually Want"
}
]
}