Any help is appreciated - please be patient with me as I am new to this. I am trying to do something that I think can probably be done easily, but can’t figure out how to do it. Basically I want to search 2 different boards for a specific value in a specific column, and return any items that match. For example, order number 12345678; in one board, this may be in the column with column ID “text0” and on the other board it may be under column ID “text24” -so I want to return:
any items on board 1 where the value of text0 is 12345678
and
any items on board 2 where the value of text24 is 12345678
When I only try to query a single board, it works with no problems (see below)
query {
boards (ids:[MY_BOARD_1]){
items_page (
query_params: {
rules: [
{
column_id: "text0",
compare_value: "12345678",
operator: any_of
}
]
# will have other rules here, but have removed them to keep this example simple
operator: or
},
) {
items{id board {
id
} column_values (ids: ["creation_log","status","status2"]){text}}
}
}
}
This, however, does not work:
query {
boards (ids:[MY_BOARD_1, MY_BOARD_2]) {
items_page (
query_params: {
rules: [
{
column_id: "text0", #this is meant to be queried from the first board
compare_value: "12345678",
operator: any_of
},
{
column_id: "text24", #this is meant to be queried from the second board
compare_value: "12345678",
operator: any_of
}
],
operator: or
},
) {
items{id board {
id
} column_values (ids: ["creation_log","status","status2"]){text}}
}
}
}
My expected output for the second bit of code is that it would return the details for the item(s) on board 1 with a “text0” value of “12345678” and that it would return the item(s) on board 2 with a “text24” value of “12345678” - and that it would not even attempt to return values for “text24” on board 1 and “text0” on board 2 because these columns do not exist on those boards.
However, I get the error “Column not found” which seems to be because it is searching both boards for both fields and stopping if both fields don’t exist on both boards - in other words it is searching board 1 by “text0” and “text24” and then searching board 2 by “text0” and “text24”. Since the boards don’t use all the same column names, this will not work; I need it to search board 1 only by “text0” and board 2 only by “text24” (or if it has to search by both columns on both boards, I just need it not to return anything for a particular column when that column doesn’t exist on the board in question, rather than giving an error that stops any part of the process from working). I’m not sure how a multi-board query would even work if it relies on both boards having the same set of column IDs, which is often not the case.
I have searched extensively for solutions, but any examples of something similar only search a single board. However, it seems like there must be a way to do what I need to do, as it accepts the argument board (ids: ) and not board_id or some other phrasing that indicates it would need to be singular. It also recognizes, when testing, that 2 boards have been specified, and the only issue seems to be that just can’t find both columns on both boards (which again, they don’t both need to be on both boards for my needs, it just needs to skip over columns it can’t find rather than breaking).
I am really stuck on this, so suggestions would be very helpful. Thanks for reading this!