---
title: "Count only not empty fields"
url: "https://openforis.support/questions/1650/count-only-not-empty-fields"
tags: ["collect"]
status: "answered"
score: 0
answer_count: 1
asked: "2018-02-20T10:13:59"
last_activity: "2018-02-24T13:14:28"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Count only not empty fields

Asked by Fehrmann on 2018-02-20

Hi all, I have a simple problem, bu don't find the solution: I like to count not-empty fields in Collect (number of height measurements per plot, where height is not measured for all trees). I tried idm:not-blank() in the Apply when field, but still I get the number of trees (all) instead the number of height measurements. Any hint is welcome!

Thanks, Lutz


## Answer (score 0, by Lauri (OF) on 2018-02-24)

Link: https://openforis.support/questions/1650/count-only-not-empty-fields/1672

Hi Lutz,

if I remember right, 'Apply when' does not work with functions, see answer at  http://www.openforis.org/support/questions/1301/table-type-entity-how-to-check-sum-of-attributes-in-a-column
 
This might work for entity 'tree':

**count(tree[idm:not-blank(tree_height)])**

But if you want that 0 is regarded as missing height value, then use this

**count(tree[tree_height>0])**

Regards, Lauri
