---
title: "Saiku: How to use boolean fields from the database?"
url: "https://openforis.support/questions/265/saiku-how-to-use-boolean-fields-from-the-database"
tags: ["saiku"]
status: "answered"
score: 0
answer_count: 3
asked: "2015-06-05T07:29:41"
last_activity: "2015-06-18T14:16:40"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Saiku: How to use boolean fields from the database?

Asked by Fehrmann on 2015-06-05

Hi support,
in my Collect database I have some boolean fields (e.g. whether a sample point belongs to a certain special management or not). These boolean fields don't show up in Saiku, but I need them as filters. How to get them there? Do I need to define a category for that? A small example code would help me a lot.


## Answer (score 0, by Lauri (OF) on 2015-06-15)

Link: https://openforis.support/questions/265/saiku-how-to-use-boolean-fields-from-the-database/270

Hi. In Calc, I got (computed) boolean variable to Saiku, works quite similarly with boolean fields:

1) create category:  
0='no', 1='yes' 

2) R script:
`tree$tree_is_alive <- ifelse( tree$tree_health ==5, 0, 1 )` 


----------


Regards, Lauri


## Answer (score 0, by Mino Togna on 2015-06-18)

Link: https://openforis.support/questions/265/saiku-how-to-use-boolean-fields-from-the-database/277

Hi Lutz,

Thanks Lauri for your answer and for posting some sample code! 

Boolean fields are not supported by Calc, you should instead use a category with two possible values (Yes/No) when you collect your data, or as Lauri suggested, you can create a new calculation step type category in Calc.

Please let us know if you need more info.

Regards,

Mino


## Answer (score 0, by Fehrmann on 2015-06-18)

Link: https://openforis.support/questions/265/saiku-how-to-use-boolean-fields-from-the-database/278

Hi Lauri and Mino,

thanks you for the example, it helped me a lot. Seems to work fine!
Lutz
