Get only columns and items with values

Hello,

i’m trying to build an API call to get all time tracking information about all boards and all items to use them for a more detailed controlling. But currently I am faced with the problem of filtering out all the zero values.

My Code:

query queryname {
  boards {
    name
    items {
      id
      name
      column_values (ids: "zeiterfassung") {
        id
        	value 
      }
    }
  }
}

The result i get:

"data": {
    "boards": [
    {
        "name": "Board 1",
        "items": [
          {
            "id": "2268502411",
            "name": "Subitem",
            "column_values": []
          }
        ]
    }
	{
        "name": "Board 2",
        "items": [
          {
            "id": "2066324479",
            "name": "1.Introduction to Sales Professional (15min)",
            "column_values": [
              {
                "id": "zeiterfassung",
                "value": "{\"running\":\"false\",\"duration\":19800,\"startDate\":1642092461,\"additional_value\":[{\"id\":173511843,\"account_id\":7248830,\"project_id\":2066324479,\"column_id\":\"zeiterfassung\",\"started_user_id\":25013207,\"ended_user_id\":25013207,\"started_at\":\"2022-01-13T09:30:00Z\",\"ended_at\":\"2022-01-13T15:00:00Z\",\"manually_entered_start_time\":true,\"manually_entered_end_time\":true,\"manually_entered_start_date\":true,\"manually_entered_end_date\":true,\"created_at\":\"2022-01-13T16:47:41Z\",\"updated_at\":\"2022-01-13T16:47:41Z\",\"status\":\"active\"}]}"
              }
            ]
          },
          {
            "id": "2066324456",
            "name": "2. Selling (30min)",
            "column_values": [
              {
                "id": "zeiterfassung",
                "value": null
              }
            ]
          },
	}
}

Obviously I only want the result of Item 2066324479. The result i want:

"data": {
    "boards": [
    {
        "name": "Board 2",
        "items": [
        {
            "id": "2066324479",
            "name": "1.Introduction to Sales Professional (15min)",
            "column_values": [
              {
                "id": "zeiterfassung",
                "value": "{\"running\":\"false\",\"duration\":19800,\"startDate\":1642092461,\"additional_value\":[{\"id\":173511843,\"account_id\":7248830,\"project_id\":2066324479,\"column_id\":\"zeiterfassung\",\"started_user_id\":25013207,\"ended_user_id\":25013207,\"started_at\":\"2022-01-13T09:30:00Z\",\"ended_at\":\"2022-01-13T15:00:00Z\",\"manually_entered_start_time\":true,\"manually_entered_end_time\":true,\"manually_entered_start_date\":true,\"manually_entered_end_date\":true,\"created_at\":\"2022-01-13T16:47:41Z\",\"updated_at\":\"2022-01-13T16:47:41Z\",\"status\":\"active\"}]}"
              }
            ]
		}
	}
}

I there any possibility to filter my result to get what i want?

Thanks in advance

1 Like

Hello @Matthias1!

As of today there is no way of filtering the results with the API so that you only get the items that contain something (anything) in a specific column.

You can get all of the items and then do this filtering on your end.

A workaround I can think about if you do not want to do that is having a status column (or dropdown maybe) that gets changed every time the text column changes (via API). So when the column changes, your server could be called and you could check if the value for that column is empty or not. If it is empty, then you set this status column to “empty” and if has a value in it, you set the status column to “With value” and then your query for getting the items that have that column populated with something could use items_by_column_values and use the status column as a reference.

What do you think?

Cheers,
-Matias