I want to filter a specific part of column array

query {
 
    boards (ids: xxxxx) {
    
    		items (limit: 10){
      	id
      	created_at
     		name
        column_values {
            id
            value
            text
            title
          }  
        }
    }
}

result:

{
  "data": {
    "boards": [
      {
        "items": [
          {
            "id": "xxx",
            "created_at": "2022-01-07T15:28:19Z",
            "name": "www.----.nl",
            "column_values": [
              {
                "id": "assessment_mi",
                "value": null,
                "text": "Maintainance",
                "title": "Assessment MI"
              },]

So I want to filter the word maintainance in grapQL or in php. So that I can count all the items that have the column value “maintainance” (because their are a lot of other values). Is their a way to filter such specifics. Because this is how I count items in php:

count($responseContent['data']['boards'][0]['groups'][0]['items']);
$totalNumber = count($responseContent['data']['boards'][0]['groups'][0]['items']);

hi @lorentz

You can’t filter this in GraphQL. When you have the array you need to filter it in the app (php, NodeJS, or any other language).

1 Like

hi bas

Thanks for your quick response, do you know a good way to filter this in PHP?
Like a for loop or maybe just using a built in php function

-lorentz

Hi Lorents

Many options here, like https://www.php.net/manual/en/function.array-filter.php

1 Like