How do I query items_by_column_values by two different column/value pairs?

where colum1 = value1 and colum2 = value2

query {
  items_by_column_values(
    board_id: 1234567890,
    column_id: "status",
    column_value: "Done"
  )
  {
    id
    name
    column_values {
      id
      text
      value
    }
  }
  items_by_column_values(
    board_id: 1234567890,
    column_id: "status2",
    column_value: "Reviewing"
  )
  {
    id
    name
    column_values {
      id
      text
      value
    }
  }
}

Hey @sillywilly :slight_smile: The items_by_column_values only can filter on one column at the moment. That said, this would be super cool! Iā€™ll pass this along to our team to review.

1 Like

Did this ever get any love? I could really use this. As it stands now It looks like I have to query multiple things and then use additional code to filter out the data I need from the JSON I receive from the query.

Hey there @Skatcher :wave:

Thanks for reaching out about this functionality of the API, and I can definitely see how the current state of things is not too ideal. Iā€™ll check this over with the team to see where things stand and weā€™ll provide further updates to you in this thread.

-Alex

Thanks @AlexSavchuk

If itā€™s handy at all, the big thing Iā€™m looking for is some expanded ability to use conditionals in my queries.
Ideally iā€™d filter the data down in my API request to the absolute necessities before doing any processing. One major example I have is as follows-
I have a user that works on pulses across multiple boards. Iā€™d like to grab the tasks hes assigned to across all boards that have a status column set to ā€œin progressā€ that way at the time of the query I can determine everything this particular user is assigned to and working on- then do my processing on the data of these tasks separately.
As it stands now it looks like I have to query each board one by one, doing two queries for each board. The first query to grab all tasks set to ā€œin progressā€ and the second to grab all tasks with that user assigned to them. Then I have to compare these results to filter down and compile all the relevant tasks into a single JSON for my program to work with.
Alternatively I could just query all the tasks on each board and then process that query to just grab the data associated to ones this user is assigned to and set to ā€œin progress.ā€

Solution A requires numerous queries, solution B requires less queries but they pull a huge amount of ā€˜uselessā€™ data. Neither is Ideal I think!

1 Like

@Skatcher

Of course itā€™s handy! Even the slightest bit of context into what you are currently working with, the things you are trying to achieve and the roadblocks you encounter along the way are really useful for us to gauge the impact this could potentially have, as well as your experience as a user when working with the API and monday.apps feature set. That is the mindset we are coming from, and itā€™s basically ā€œwe careā€. :slight_smile: I hope that sheds a bit more light on this.

To be transparent with you, it might take me a bit longer to get back to you with more details from our development team, but when I do get something more insightful to share here, Iā€™ll make sure to share.

-Alex

1 Like

Hey @AlexSavchuk I wanted to pop back in with a more specific query in case we can brainstorm a work around or there is something Iā€™m missing because this is currently becoming quite a barrier for what iā€™m trying to accomplish.

I have 6 project managers and a pool of designers that are shared amongst the PMs. Iā€™d like to be able to get any active task assigned to a specific designer.

It seems the best way so far for me to do this is to use the items_by_column_values query with some Aliases.

hereā€™s an example query for 1 PM:

Sean: items_by_column_values(board_id:SeansBoardID column_id:"designer" column_value:"James"){
    id
    name
    column_values(ids:"design status"){
      text
    }
  }

This lets me grab all of my boardā€™s tasks that are assigned to James, grab their design status, and then I can use javascript to check the JSON for any tasks that are ā€œin progressā€ or ā€œnot startedā€ from there. Thatā€™s no problem. Unfortunately this uses about 100k complexity. Run it for 6 PMs boards and weā€™re at 600k complexity meaning if I try and grab active tasks for more than 16 designers in a minute Iā€™m at my complexity cap. On top of this Iā€™d like to note that weā€™ve managed to constrain our PMā€™s tasks to just 6 boards, one per PM, to make things like this possible. Weā€™d love to have multiple boards per PM for better organization but unfortunately that causes huge headaches for things like dashboard limits or API query limits.

Is there a better way to do the query Iā€™m looking for? The alternative, grabbing every item from every board, resulted in about the same 600k complexity for what itā€™s worth, so that unfortunately is out as well.

I apologize if the answer is the same- it may just be that this type of query isnā€™t supported very well yet. I wanted to just jump back into this conversation with a very specific example in case there was any other suggestions

1 Like

@Skatcher

I am sorry for my delay in response here! Thanks so much for circling back here and providing further context to what you are looking for and the current roadblocks you are experiencing on the way.

Iā€™ll have to double-check this with the team to see if we can find a better solution to what youā€™re looking for here and Iā€™ll get back to you in this thread as soon as I know more :slight_smile:

-Alex

Hi all! To update, we do now have the ability to filter by multiple values within a single column. We havenā€™t quite released the ability to filter by multiple columns just yet.

Check out my recent announcement for more information: [RELEASED] Items by Multiple Column Values Query.

Thanks!