Small GraphQL Doubt

Hello, monday.com community. I am trying to get the name of a column given its id and board id. My code is

query($boardId: [Int], $columnId: [String]) {
        boards(ids:$boardId){
          columns(ids:[$columnId]){
            title
          }
        }
      }
const variables = { boardId, columnId };
const response = await mondayClient.api(query, { variables });

I am facing the following error

{
[0]   errors: [
[0]     {
[0]       message: 'List dimension mismatch on variable $columnId and argument ids ([[String]]! / [String])',
[0]       locations: [Array],
[0]       fields: [Array]
[0]     }
[0]   ],
[0] }

Would appreciate any help. Thank You!!.

Did you try ```
columns(ids:$columnId){

if $columnId is already an array.
1 Like

Hey @rohan ,

try it like that:

const variables = variables: { boardId: [boardId], columnId: [columnId] }

Greetings

1 Like

Thank You, @TMNXT-Dev @LaurentConroux

1 Like

@TMNXT-Dev and @LaurentConroux - thanks for being on top of this! You guys rock.

@rohan I’m glad the community was helpful :slight_smile: Sorry we weren’t the first to resolve this!

-Alex

@TMNXT-Dev and @LaurentConroux I am also getting the same error when I am trying to fetch by column values.
I have tried the above mentioned solution as well but still getting the same error.

.

Any suggestion would be appreciated…!

Hey @aquibk,

the items_by_column_values doesn’t accept Arrays.
This is why you get the “dimension mismatch”.

What I do in situations like this, I go to the API playground and look for the query/mutation I want to use.

And look for the definition in there:

Simply change:

$boardId: Int!

const vara = { boardId: boardId }

And make sure you pass an Integer and not an Array.
Adjust the other two parameters as well and it should work.

Greetings

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.