Query items by column value for two different columns

Hi Everyone,

I found a couple of other threads that seem to be asking this same question, but they have been closed and do not offer a solution or a workaround.

I’m wondering if there is a way to write a graphql query for the items on a board that meet criteria for two different columns. The “items_by_multiple_column_values” query allows us to query two different values for one column, but I need to query results that have one value for 1 column AND one value for another column. If this can’t be done with a single query, how might one achieve a similar result?

Thanks in advance for your help!
-max

Hello @max!

As you said, this can’t be achieved using Monday’s API with one query. What I would do is make two different queries (one for each column value), and then in my server, check the IDs of the items that appear in both responses.

You could also use one query and look for the value in one of those two columns, and retrieve the data inside second column in that query. You would then have to check in the retrieved items which ones also have that specific value in the second column.

I hope this helps!

Cheers,
-Matias

Hi Matias,

Thanks for the response. This is helpful. I think I will attempt a workaround with the second option you propose.

Best,
Max

Sorry, @Matias.Monday, how might I do what you suggest above? That is, how could I query one columns values and retrieve the data inside the second column of interest?

Hello again @max!

You could use a query like this one:

{
  items_by_multiple_column_values(board_id: 123456, column_id: "status", column_values: "Done") {
    id
    column_values(ids: "text") {
      text
    }
  }
}

With this query, you would get the items with the status column set to “Done” and you would get the text column value for all of those items, therefore you could check which items have the text you are looking for and have “Done” at the status column and you would have their IDs.

You could add the IDs of other columns if you need them.

Hope it helps!

Cheers,
-Matias

Thank you! I’m new to this and was struggling with the column_values field.

Unfortunately, it looks like it’s still going to be a challenge to do what I want, but that seems to be the result of careless design in how we have our information spread across board, along with the limitations of supported columns.

It would be great if mirror and connect boards columns were supported! Thanks again for the help.

Hello again @max!

I am glad that was helpful. You’ll get there :muscle:

I hear you. These are requests that our R&D team are aware of and I will make sure to add your vote to them so that hopefully they can be implemented soon.

If you need anything else, you can come back to the community and/or send as an email to appsupport@monday.com

We are here for you!

Cheers,
-Matias