---
title: "Defining the default value of a boolean"
url: "https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean"
tags: ["collectearth"]
status: "answered"
score: 0
answer_count: 5
asked: "2018-09-07T15:03:08"
last_activity: "2020-02-19T17:09:49"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Defining the default value of a boolean

Asked by flandsberg on 2018-09-07

Hi,

I would like my field "confident in pct tree cover in cropland?", which is a boolean, to be false/"no" if the response to "confident in pct area in cropland?" (also a boolean) is false/"no" because if we are not sure of the cropland area, we cannot be sure that we have the right percent tree cover in cropland.

I cannot make it work... In the default value for "confident in pct tree cover in cropland?", I am using  lulc[lulc='high_forest']/lulc_cfdce = 1 for "applied when" but I am unable to get the boolean value (in expression? in constant value?) to be set at false then.

Thanks VERY MUCH for any help!

Best,

Florence


## Answer (score 0, by Open Foris on 2018-09-07)

Link: https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean/1938

When using the validation expressions try to compare the ouput of logic expressions with the value **false()** and **true()** instead of 0 and 1, that should work.
So the expression would be:

    lulc[lulc='high_forest']/lulc_cfdce = true()

> Not sure how to make sure it comes to you, so here it is also :-)... Thanks for the first answer! Now, I want to assign a default value of "false" to "high_forest_pct_treecover_cfdce" when "lulc[lulc='high_forest']/lulc_cfdce = false ()". How can I assign "false" to "high_forest_pct_treecover_cfdce"? Many, many thanks!!! (flandsberg)

## Answer (score 0, by flandsberg on 2018-09-10)

Link: https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean/1939

Fantastic, it works in terms of the relevance!! 

But now, I want to assign a default value of "false" to "high_forest_pct_treecover_cfdce" when "lulc[lulc='high_forest']/lulc_cfdce = false ()".

How can I assign "false" to "high_forest_pct_treecover_cfdce"?

MMMMMMMMMMMMMMMMany thanks!!!


## Answer (score 0, by Lauri (OF) on 2018-09-12)

Link: https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean/1941

Default values for boolean variables and simply FALSE or TRUE (in capital letters).

> Hi, Thanks for helping me out. If I put as default value "FALSE" in "constant value" and "lulc[lulc='high_forest']/lulc_cfdce = false ()" in "Apply when", it does not work... Meaning, the default value of high_forest_pct_treecover_cfdce is not becoming "false" when lulc_cfdce for high_forest is "false" (note that lulc_cfdce is in a table). Where is my error? Thanks, Florence (flandsberg)

## Answer (score 0, by Lauri (OF) on 2018-09-17)

Link: https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean/1951

Dear Florence,

sorry I gave you premature information. This default value for boolean attribute works in Collect, not yet in Collect Earth. That issue will be taken into account when developing future version of CE. Thanks, Lauri


## Answer (score 0, by flandsberg on 2020-02-19)

Link: https://openforis.support/questions/1937/defining-the-default-value-of-a-boolean/2690

Hello,

A follow up on this. Has this been included in Collect Earth yet? I tried again and it does not seem to work.

Thanks,

Florence
