---
title: "Create default value for hierarchical code list"
url: "https://openforis.support/questions/3545/create-default-value-for-hierarchical-code-list"
tags: ["collect", "collectmobile"]
status: "accepted"
score: 0
answer_count: 1
asked: "2023-01-18T17:01:25"
last_activity: "2023-01-18T21:17:19"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Create default value for hierarchical code list

Asked by bryant on 2023-01-18

Hello OF Team!

I am working with hierarchical code lists. My level 1 code is "Forest" and level 2 is "Unit". Not all Forests have multiple Units. When the user selects a Forest that only has a single Unit within it, I would like the value for Unit to automatically populate with the only option within the selected Forest. Is this possible? 

Thank you!

Bryant


## Accepted answer (score 0, by Stefano (OF) on 2023-01-18)

Link: https://openforis.support/questions/3545/create-default-value-for-hierarchical-code-list/3546

Dear Bryant,  
Now it's not possible to do this kind of automatic selection.  
If the code list items with only one level are not so many, you can try to define a default value for the unit attribute using several "Apply if" condition, so if the condition matches one of the items with only one level, then a value will be applied.  
Let us know if this helps you, many thanks.  
Open Foris Team
