Order by multiple fields

Hi Sebastian,

I’m trying to order a query by two or more fields.

Example:

data/make/en_US and data/model/en_US

but Squidex is not letting me; it spits out an error:

{
    "message": "Validation error",
    "traceId": "00-7ede507b7e06c944b5987e61a5c5c194-e26538029c40ba4a-00",
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "details": [
        "Failed to parse query: A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.String' for operator kind 'And'."
    ],
    "statusCode": 400
}

I took the “and” syntax from this example:

// AND: Both condition must be true

$filter=data/population/iv eq 1000000 and data/isCapital/iv eq true

// OR: One condition must be true

$filter=data/population/iv eq 1000000 or data/isCapital/iv eq true

I took it from this page:

https://docs.squidex.io/02-documentation/developer-guides/api-overview/api

The following works fine:

data/make/en_US

Any suggestions?

I am a little bit confused. Are you ordering or filtering?

I literally found the answer 2 mins ago:

under:

4.2. Orderby System Query Option ($orderby)

And in my case the query that I needed was the following:

{{baseUrl}}/content/db/my-schema/?$orderby=data/make/en_US desc,data/model/en_US desc,data/size/en_US desc&$filter=data/ShowInApp/en_US eq true

1 Like

Great. I also added it to the docs.

1 Like