I am attempting to query entries via that have a field (ex numberField
) with field type Number. Some of the entries don't have a value for this field, so in the response it has null
. I am wanting to order the entries by this Number field, but I am wanting the ones with a valid number to be ordered first, and then the ones with values of null
to come after. Examples below:
Rough query
query getElements {
entries(
section: ["anEntryType"]
orderBy: "numberField ASC"
) {
id
... on anEntryType_default_Entry {
numberField
}
}
}
Response
{
"data": {
"entries": [
{
"id": "1",
"numberField": null
},
{
"id": "2",
"numberField": null
},
{
"id": "3",
"numberField": 100
},
{
"id": "4",
"numberField": 200
},
]
}
}
Desired Response
{
"data": {
"entries": [
{
"id": "3",
"numberField": 100
},
{
"id": "4",
"numberField": 200
},
{
"id": "1",
"numberField": null
},
{
"id": "2",
"numberField": null
},
]
}
}
Is this possible? Thanks!