oTree Forum >

Verticle Table and Data exporting

#1 by Charlie_T


I have two unrelated questions.

The first is how to create a table with vertical radio select buttons.  I looked at the example under the forms page https://otree.readthedocs.io/en/latest/forms.html#example-radio-buttons-in-tables-and-other-custom-layouts However what I want is a 3 x 2 table with each row starting with a radio select button, and then 2 cells of additional information for each choice. I tried simply inverting the <td> and <tr> tags in the example which did not work.  Ultimately, because there will be 10 rounds with the information in the table changing each round looping across choices may not be a very viable option anyways.  I could just use Raw HTML radio buttons but I was hoping there might be something akin to {{ field.myfield.choice1 }} that I could insert into the HTML table. 

The second question I have is about auto exporting data.  I could create a function that appends all the data from all the apps for each player to an array and exports that, but is there an in-built way to export data automatically? Is the data stored in one specific location such that I can have python save it as a CSV at the conclusion of an experimental session?  



#2 by Chris_oTree

(1) You can do {{ field.myfield.0 }}, {{ field.myfield.1 }}, etc. to access the individual radios.

(2) Data export is available in the admin interface. Click "Data" in the header bar at the top of the window.

#3 by Charlie_T

Hi Chris,

1. I cannot seem to get this to work, it throws an error "Cannot resolve the variable 'field'"  Is there some additional information I need to include? 

2. I am aware of the data export in the admin interface, I was hoping there was a way to automatically export the data at the end of the experiment rather than my having to go click to export.  My concern is always that I might forget to export the data before closing the room.

#4 by Chris_oTree

(1) sorry i meant {{ form.myfield.0 }}.
(2) you can still download the data after you close the room.

#5 by Charlie_T

1. Ok great that works now, thanks so much

2. That is also good to know.

Write a reply

Set forum username