Hi,
I am building a query that I want to use for fetching items from a board with two conditions. The problem is that API rejects my query when I want to use operator between for date column type.
Initially I wanted to make a query that would basically say: “Give me all items that have checkbox checked and that have start date greater than some_date”.
But I couldn’t make it work so I decided to ask it in the way: “Give me all items that have checkbox checked and that have start date between date_1 - date_2”.
This works great when I write dates directly but doesn’t work when I use variables.
query AllItemsFiltered(
$boardId: ID!,
$checkboxColumnId: ID!,
$startDateColumnId: ID!,
$limit: Int!,
$columnValuesIds: [String!]!) {
boards(ids: [$boardId]) {
...BoardItem
items_page (limit: $limit, query_params: {
rules: [
{
column_id: $checkboxColumnId,
compare_value: [null],
operator: is_not_empty
},
{
column_id: $startDateColumnId,
compare_value: ["2023-03-04", "2024-02-02"], **# THIS WORKS**
operator: between
},
],
operator: and
}) {
cursor
items {
...ItemFragment
column_values(ids: $columnValuesIds) {
...ColumnValueItem
}
}
}
}
}
On the other hand when I pass start and end dates as variables then I am getting API error saying: “List dimension mismatch on variable $startDate1 and argument compare_value ([CompareValue!]! / CompareValue!)”
query AllItemsFiltered(
$boardId: ID!,
$checkboxColumnId: ID!,
$startDateColumnId: ID!,
$startDate1: CompareValue!,
$startDate2: CompareValue!,
$limit: Int!,
$columnValuesIds: [String!]!) {
boards(ids: [$boardId]) {
...BoardItem
items_page (limit: $limit, query_params: {
rules: [
{
column_id: $checkboxColumnId,
compare_value: [null],
operator: is_not_empty
},
{
column_id: $startDateColumnId,
compare_value: [$startDate1, $startDate2], **# THIS DOESN'T WORK**
operator: between
},
],
operator: and
}) {
cursor
items {
...ItemFragment
column_values(ids: $columnValuesIds) {
...ColumnValueItem
}
}
}
}
}
I would appreciate any help with this one. Btw. I am using v2023-10 API.