Items_page query parameters question

I’m attempting to write an items_page query that will return names of location codes only where all instances of a location code are in billing status. In a simplified example, the desired result of my query would return CD34 and EF56

Location Name Location code Location Section Status
AB12 AL1 AB12 1 in progress
AB12 AL2 AB12 2 billing
CD34 TN1 CD34 1 billing
CD34 TN2 CD34 2 billing
EF56 TN1 EF56 1 in progress
EF56 TN2 EF56 2 in progress
GH78 GA1 GH78 1 billing
GH78 GA2 GH78 2 billing
query GetAllInBillingLC {
  boards(ids: 1234567890) {
    items_page(
      query_params: {rules: 
        [{column_id: "locationcode", 
           compare_value: [Is left blank],
          operator: any_of},         
          {column_id: "status", 
           compare_value: [2]}]
           }
    ) {
      cursor
      items {
        name
      }
    }
  }
}

This is an example of my best guess as to how to structure the query. It doesn’t have my real information since that’s from my work, hence the dummy board ID and simplified chart.
In any case, this is the error I get when I run my actual query in the playground:

“status_code”: 500,
“error_message”: “Internal server error”

Any suggestions would be greatly appreciated.
Thanks!

Hi @Rosalind90 I’m not sure if I’ve completely understood your query requirements. It seems in your code, there is some additional logic involved beyond what you’ve described.

I’ve noticed a minor mistake in your code: column_id: "locationcode". Column IDs are generated by Monday and follow the schema {datatype}{auto increment number}. In your case, a correct column ID would be something like text, text1, text2, etc.

Nevertheless, I attempted to take a subset of your data and wrote a simple query to fetch the location code where the status value matches a certain index.

1 Like

In my case, this still returned results outside of what I was needing. It may have to do with relationships between values in my actual data that I haven’t accounted for yet. Your answer gave me the confidence to try working with fragments. They’re very useful! I’m going to keep trying things, and I’ll let you know what I get from there.