---
title: "is it possible to enter variables of a code list in the field randomly but have them in a chronological order in the database in Collect?"
url: "https://openforis.support/questions/1832/is-it-possible-to-enter-variables-of-a-code-list-in-the-field-randomly-but-have-them-in-a-chronological-order-in-the-database-in-collect"
tags: ["collect"]
status: "answered"
score: 1
answer_count: 4
asked: "2018-06-14T09:05:33"
last_activity: "2018-06-14T16:27:27"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# is it possible to enter variables of a code list in the field randomly but have them in a chronological order in the database in Collect?

Asked by beka on 2018-06-14

Dear Open Foris Community,

We struggle with the following problem regarding Collect and later the data analysis of the collected data. 
We have a code list for habitat features of our trees and the field teams can choose up to 10 variables at the same time. The problem at the moment is that they are transferred into the database in the order they were clicked on in the field and not chronologically into the columns with the applicable numbers. Is there any easy solution to this? We just thought that it would be easier if we didn’t have to do this manually during the cleansing phase.  This is what we would wish for it to look like. 
(see table 1)
https://drive.google.com/drive/folders/0B1GL4ASXM8jjYmRYQVFzZGlTZ0E

At the moment it looks like this: 
(see table 2)
https://drive.google.com/drive/folders/0B1GL4ASXM8jjYmRYQVFzZGlTZ0E


But of course we are open to other ideas to solve this issue, we assume others have struggled with similar attributes. Possibly our approach is overcomplicating the whole process. 

Thank you for your help!


## Answer (score 2, by Stefano (OF) on 2018-06-14)

Link: https://openforis.support/questions/1832/is-it-possible-to-enter-variables-of-a-code-list-in-the-field-randomly-but-have-them-in-a-chronological-order-in-the-database-in-collect/1835

Hi Beka!  
In the exported csv file, a multiple code attribute is exported into several columns, each column corresponding to the position of the selected values (e.g. tree\_habitat[1] = first selected value, tree\_habitat[2] = second selected value, tree\_habitat[N] = Nth selected value...).  
If you want to see the values in a different way, you can select among the `Additional options` of the CSV export `Expand code attributes (add boolean columns for each code value)`.  
The result will be a csv file with additional columns, one per each value of tree\_habitat (e.g tree\_habitat_1, tree\_habitat_2) and true or false if the value has been selected or not.  
![csv data export additional options][1]
Thanks,  
Open Foris Team

  [1]: http://www.openforis.org/support/upfiles/csv_export_additional_options.png


## Answer (score 2, by Lauri (OF) on 2018-06-14)

Link: https://openforis.support/questions/1832/is-it-possible-to-enter-variables-of-a-code-list-in-the-field-randomly-but-have-them-in-a-chronological-order-in-the-database-in-collect/1836

Hello Beka, 

I offer another solution. I assume that in your code list for habitat features there are more than 10 options. Anyway, create 10 (code) attributes for your entity, hab1..hab10. Set them as Not required, and add custom checks for hab2..hab10, as follows 

![alt text][1]


![alt text][2]


![alt text][3]


  [1]: http://www.openforis.org/support/upfiles/image1.jpg
  [2]: http://www.openforis.org/support/upfiles/image2.jpg
  [3]: http://www.openforis.org/support/upfiles/image3.jpg

I am missing the custom error message in this example but that you can add as needed. 

This is not giving from Collect exactly that table what you are looking for, but in the data analysis you can get frequencies for categories in hab1..hab10 as necessary.

Regards, Lauri

> Still as a comment: solution above is clumsy from the data entry point of view! It is lacking the advantage doing multiple selections at one time. (Lauri (OF))

## Answer (score 2, by Lauri (OF) on 2018-06-14)

Link: https://openforis.support/questions/1832/is-it-possible-to-enter-variables-of-a-code-list-in-the-field-randomly-but-have-them-in-a-chronological-order-in-the-database-in-collect/1839

Beka, OF Team programmer can help in that question regarding error message. I have - again - a bit different solution: add habitat selections into a calculated text field. This additional text field (Dist_txt below) can be set invisible (deselect Show in entry form). Use function shown below 
 
![alt text][1]
 

![alt text][2]


  [1]: http://www.openforis.org/support/upfiles/image5.jpg
  [2]: http://www.openforis.org/support/upfiles/image6.jpg

When exporting the data into CSV, all selections goes into one field, which requires parsing in R or Excel.

-Lauri


## Answer (score 1, by beka on 2018-06-14)

Link: https://openforis.support/questions/1832/is-it-possible-to-enter-variables-of-a-code-list-in-the-field-randomly-but-have-them-in-a-chronological-order-in-the-database-in-collect/1838

Dear OF team,
Thanks for your help. I tried to follow the instruction you sent and I faced on the following problem (see the link): https://drive.google.com/drive/folders/0B1GL4ASXM8jjYmRYQVFzZGlTZ0E

Thanks again, 
Best, 
Beka
