Feature update – *searchable answers, store data in a custom column of the CSV file
Here’s what’s new: |
Searchable answersOften we want to ask users a question with a large set of predefined answers (e.g. the country where they are in). A multiple-choice question will do the job but will be awkward to use because finding the desired answer may require a lot of scrolling. In such cases, *searchable questions are a more user-friendly solution. Here, you still have a list of valid answers, but the user initially sees a box where they can start typing their answer. As they do, a drop-down list appears with matches for what the user is entering.
You will find some programs in the program library that use this functionality:
|
Storing data in a custom column of the CSV file that stores all user responsesAny variable in your program will show as a column in the CSV file when you download the generated data. The name of the column will be the variable name. But sometimes it’s useful to store data in a column whose name is determined while the program is running. The new `data::store` feature lets you do exactly this by calling:
Then you ask the users to rate each movie that they entered:
When you download the CSV file, you will have a column with the name “How many stars would you give the movie {movie}?” and for each run, you will have all the ratings that the user provided separated by a pipe(|). The variable `answer` will also be in the CSV file, and it will only have the last rating the user provided (since its value gets overwritten in every iteration).Ideally, you should have a separate column for each movie, with its corresponding rating if a particular user selected that movie. You can accomplish this using >>data::store(columnName, value) :
This way, if the value of movies is [“Titanic”, “Easy Rider”, “Dune”], there will be three columns on the CSV file with the names “Titanic”, “Easy Rider” and “Dune”, with the ratings provided by the users who watched either of those movies. |