Skip to main content

Hi!


Is there a way to call items_page sorting by a column using desc direction and bring the non-null (non-empty) items first?




In this query I’d like to return in this order r8, 4, null] instead of fnull, 8, 4].

Hello there @helderalvesappfire,


If you want the order to be desc, you will get the null first unless you exclude the nulls with a query like this one:


{
boards(ids: 1234567890) {
groups(ids: "topics") {
items_page(
query_params: {order_by: [{column_id: "score54", direction: desc}], rules: [{column_id: "score54", compare_value: "", operator: is_not_empty}]}
) {
items {
id
column_values(ids: "score54") {
text
}
}
}
}
}
}

Cheers,

Matias


Thank you @Matias.Monday .


But I would like to bring the nulls at the end also and it starts to get complex to track pagination for 2 queries (one with is_not_empty and other with is_empty).

It would be nice to have something like


query_params: {order_by: [{column_id: "score54", direction: desc, nullsLast: true}]}

Hello again @helderalvesappfire,


I will share this as a request for our R&D team!


Cheers,

Matias


Reply