APi version 2023-10 CompareValue as arguments

Hello,

I’m trying to use the new function item_page,
And i would like to know how to pass an array of CompareValue to the rules param.
Here is my query (not accepting the array so not working):

query GetItemPage($boardId: [ID!], $columnId: ID!, $columnValue: CompareValue!, $columnId1: ID!, $columnvalue1: [CompareValue!]) {
  boards(ids: $boardId) {
    items_page(
      query_params: {rules: [{column_id: $columnId, compare_value: $columnValue},{column_id: $columnId1, compare_value: $columnvalue1, operator: any_of}], operator: and}
    ) {
      items {
        id
        name
        updated_at
        created_at
        column_values {
          id
          value
          text
        }
      }
    }
  }
}

with vars :

{
  "boardId": 321654987,
  "columnId": "name",
  "columnValue": "TEST",
  "columnId1": "contact_account",
  "columnvalue1": [123456789, 987654321]
}

i want to achieve the same thing as below (working query but i need to pass the array as a variable):

query GetItemPage($boardId: [ID!], $columnId: ID!, $columnValue: CompareValue!, $columnId1: ID!) {
  boards(ids: $boardId) {
    items_page(
      query_params: {rules: [{column_id: $columnId, compare_value: $columnValue},{column_id: $columnId1, compare_value: [123456789, 987654321], operator: any_of}], operator: and}
    ) {
      items {
        id
        name
        updated_at
        created_at
        column_values {
          id
          value
          text
        }
      }
    }
  }
}

with vars :

{
  "boardId": 321654987,
  "columnId": "name",
  "columnValue": "TEST",
  "columnId1": "contact_account",
}

Thanks

Hello there,

I believe this should work if you use a structure like this one:

query GetItemPage($columnvalue1: CompareValue!) {
  boards(ids: 1234567890) {
    items_page(
      query_params: {rules: [
        {column_id: "name", 
          compare_value: $columnvalue1, 
          operator: any_of}], operator: and}
    ) {
      items {
        id
        name
        updated_at
        created_at
        column_values {
          id
          value
          text
        }
      }
    }
  }
}

Variables:

{
  "columnvalue1": [
    "Item 1",
    "Item 2"
  ]
}

Let me know how that goes!

Cheers,
Matias

Hello Matias,

Thanks for your reply !

I’ve tested your solution and it’s solved my problem.

When i use the array in the api playground, the var “columnvalue1” and the values are underlined in red with error message in the tooltip “expected value of type CompareValue”, but that does not prevent the request for working and returning result.

Thanks
Yassine

Hello again @y-labyed,

That’s great to hear!

Regarding the underlined text, I will send this to our team so that they can take a look into it :grin:

Cheers,
Matias

1 Like