Typing in the Control options in the Item List field can be tedious, is prone to error, and won't be updated automatically if new codes are added to your variable later. You can automate the options or add many at a time by providing a table of options instead. This article describes how to use a table to create a long list of items to appear in a Control's item list. You will go from a table with a long list of items (such as a list of countries found online)...
...to the same list appearing in a Control box item list, or as a List Box item menu:
Requirements
- A Control Box control manually created through Anything > Page Design > Control (see How to Create a Combo Box Filter or How to Create a List Box Filter).
- A table with a list of items to show in the control either:
- A pasted table - in this example we use the pasted table above of a list of countries, see How to Paste or Enter a Table.
- A built-in table with the items in the row headers.
- An R table with the items as row headers or in the first column (if the rows are numbered).
Method
- Select the table with items you want to provide to the Control box.
- Make sure your table has a relevant name in the General > General > Name such as Country_List in this example.
- Select your control box or insert a new one through Anything > Page Design > Control > Combo Box (Drop-down) or List Box.
- With the control selected go to the object inspector > Control > Item List and delete First option; Second option, leaving the menu empty.
- Click into the Items from field and then click on your table from step 1 (eg Country_List) to use the values as the items in the Control.
- [Optional]: Depending on your requirements, you can change Selection mode from Single selection to Multiple selection and configure other options.
- [Optional]: If you wan to use this Control to filter outputs, see How to Connect Filters to Controls Using R Code to create the filter variable.
Next
How to Select Which Rows or Columns to Show in a Visualization Based on a Control Box Selection
How to Connect Filters to Controls Using R Code
How to Create a Combo Box (Drop-Down Control) With a Dynamic List
How to Use the Same Control on Multiple Pages
How to Dynamically Change a Question Based on a Control Box