Display read-only fields based on selected values

Hi

I have a questionnaire that can be used on different dates on different locations.

For example, On the 10 Jan the user visits France, Paris, on the 15th Jan he visits England, London, on the 20th of Jan he visits Spain, Madrid and so on.

I have a xlsform where the user selects the day (select_one type question) and once he presses Next, the location should be displayed, just to make sure that he is on the correct location.

So, based on the day selected I need to display the correct location (read only).

The location must be on the submitted form for further analysis (ideally on different cells : 10January| France| Paris | Tour D'Eiffel | etc) .

I went through the documentation but I didn’t find something that might help.

A solution might be to put all the information on the select_one field but it this case, all the data (date, country, city) will be on a same cell and it will be difficult to handle it. (See below)

image

In few words, I need to select a date, display the correct location and sumbit the data on different cells for analysis.

Any ideas/solutions will be much appreciated .

Thanks

I think this is the first Irish based form I have ever seen on the forum :slight_smile:

You need to have something which connects the dates to the locations. One of the best ways to do that is to use an external CSV data set which just lists the locations in one column and the dates in another. Your first question then becomes a "select_one" on the date column of this file. There is a lot of info online about using CSV data sets with ODK forms but if that part doesnt work for you then let us know and hopefully the forum can help you out with that step.

The second part then is displaying the location. I would suggest possibly using a "text" type question and then using a formula in the "calculation" column to identify the location for that date. (I am assuming you are using excel to build your form here - please correct if that assumption is not accurate). Your calculation would probably use the "pulldata()" function and of course the "read_only" column would be set to "TRUE".

Hopefully that gives you the right functions to work with but feel free to post if you hit obstacles. The external dataset is great because it allows you to later change the locations and dates without modifying the form itself.

2 Likes

Hi Noel,

pulldata() function did the trick :slight_smile:

I used it to retrieve the data of each field (country, town etc.) in different cells based on the date selected

pulldata('CIF_Schedule','Country','key',${ddate}) to get the country's name from the external file CIF_Schedule.csv
pulldata('CIF_Schedule',Town','key',${ddate}) to get the town's name
and so on

Thanks a lot for your help,
Kind regards
Chris