Dynamic dropdown menu

This is the Online Help page for the dynamic dropdown menu widget in WrapCreator.

The purpose of the Dynamic dropdown widget is to make it easy to create a dropdown menu where the options are controlled from the spreadsheet and can be changed by a formula. If you only need a simple, static list of options, it is usually easier to use the ordinary Dropdown list widget in the Basic widgets category.

Due to the inherent complexity of the Dynamic dropdown widget, it cannot be tested in Excel. You must convert your spreadsheet to a web page to test a Dynamic dropdown menu.

The Dynamic dropdown widget operates in one of two modes, either with a one-dimensional table or a two-dimensional indexed table with lookup. It also supports the rare case when a very long list of options is provided as a delimited list.

Generate options from a fixed row or column

In the one-dimensional mode, you provide a list of options in a cell range in your spreadsheet. The cell range can be either row- or column-oriented, and empty cells are ignored. The widget illustrates this, with a cell range containing three choices in a row.

Screenshot of the options range and lookup cell options for a dynamic dropdown menu with fixed rows or columns.

In contrast to the basic dropdown widget, however, this cell range need not contain a static list of choices.

  • You can ask a customer to select one of the credit cards that the customer has on file.
  • In an order form, you can have a “Quantity” menu for each product contain a dynamically calculated list of accepted ordering quantities, i.e. the number of items in a box, carton or pallet.
  • You can create a list of only those account numbers that are eligible for a certain transaction, e.g. checkings or savings accounts.
  • You can provide a list of destinations that only include those destinations that fulfill a set of criteria defined elsewhere in the spreadsheet.

Each cell can contain a different formula that assembles, calculates or conditionally selects content for the menu item. Here are a few examples of formulas you can expect to find in a dynamic dropdown:

  • =if(country_name="", city_name, city_name & ", " & country_name)
  • =vlookup(postcode, postcode_to_city_table, 2, FALSE)
  • =if(location_1_available, location_1_name, "")

Make the cell range big enough to accommodate the largest number of choices you will ever need. If you don’t need all choices there’s room for, just leave the redundant cells empty and they will be ignored when the dynamic dropdown is created.

If you want to add a prompt, e.g. Select one of your credit cards on file at the top of the menu, just make it the first choice in the cell range.

Screenshot of a spreadsheet with options for a dynamic dropdown menu

Learn more

There is an example of a one-dimensional Dynamic Dropdown in the tutorial for the Link Image widget

Generate options from matching row or column

The two-dimensional mode is best explained with an example. Let’s say we want to show the world’s biggest cities per country. We create a list of countries in a column, and a list of cities in the same row as the corresponding country.

In the table below, the index is located in the first column, in cells A2:A11. For each country, there is a list of cities on the same row. For Japan, the biggest cities are Tokyo, Osaka and Nagoya, in that order.

Screenshot of a table in Excel with countries and cities

It is very easy to display this index as a country selector, using a one-dimensional dynamic dropdown. Note that we have already placed a user prompt in cell A1 at the top of the list. Just select A1:A11 in the worksheet above as the cell range to provide the choices for the one-dimensional dynamic dropdown.

When the web page is shown in the web browser, the dropdown menu will display the user prompt Select country. In the example, the user has selected India.

Screenshot of a dynamic dropdown menu with countries taken from a table

When the user moves on to the second dropdown, its contents are set dynamically, depending on the country selection. For India, the choices are located in cells B5:G5 of the spreadsheet above, and the city dropdown would immediately change to look like this:

Screenshot of a list of cities for the selected country

Every time you change the country in the upper dropdown menu, the appropriate cities appear in the lower dropdown menu. This can dramatically increase the speed of data entry, the accuracy and the quality of an electronic form.

Settings for the two-dimensional mode

In the two-dimensional mode, you provide the cell range for an indexed, two-dimensional table in the Options Range setting.

First column

Do you want the index in a column, with the options in the cells to the right, as in the country/city example above? We call this the (Index is in the) First Column setting. If the index is longer than the longest list of choices, this may be the easiest layout to work with.

Screenshot of the options range and lookup cell options for a dynamic dropdown menu with matching row

First row

If the index is short but the number of options can be long, it may be more convenient to use the (Index is in the) First Row setting. In this setting, the top row of the Options Range contains the index, with the menu choices for each key in the cells below it.

Screenshot of the options range and lookup cell options for a dynamic dropdown menu with matching column

A separate Lookup Cell is matched against the index. In the “major cities” example above, the Lookup Cell is the one-dimensional dropdown used to set the country. It can contain the value Japan. When the Lookup Cell matches a key in the index, the dynamic dropdown menu is populated with all the menu choices for that key. For Japan, those choices are Tokyo, Osaka and Nagoya.

Dynamic Lookup Cell

You can use many types of widgets for the Lookup Cell, e.g. radio buttons, sliders and even check boxes.

The value for the Lookup Cell doesn’t have to come from a widget, any cell in the spreadsheet can be used for lookup.

  • You have a table of sales tax (VAT)  per country, and you already know the country from the ship-to address.
  • You have a survey where questions are responded to with either Yes/No or the values 1-10. Instead of defining all the dropdowns manually, you use the same options range for all questions in the survey and use a fixed setting per question to select the response type. If you later want to change the options to True/False or 1-5, you only have to change the options range.

Dynamic menu contents

Dynamic dropdowns take their choices from a cell range in the spreadsheet. You may fill this cell range with any kind of content and change it depending on other cells.

As an example, you may know the origin, destination, dimension and weight for a pending shipment. Using this information, your spreadsheet dynamically assembles a price list from three couriers. All the user has to do is to determine the urgency and pick the best choice.

Screenshot of a dynamic dropdown with dynamically assembled content

Advanced applications

Why stop at only two dimensions?`You can use one menu for a country, a second for postal codes per country, and a third for cities per postal code. And a fourth for streets per city! There is no technical limit to the number of levels or “dimensions” in such a menu structure.

You can create all the menu choices in the Options Range using the same programming techniques as we described for the one-dimensional dropdown above.

Generate options from a delimited list

If you have a very long list of options provided to you as a delimited list, it may be easier to use the delimited list directly in the dropdown from a single cell, instead of pasting each option into a separate cell the way one would naturally work with Excel. You enable this mode by selecting Generate options from a delimited list.

Screenshot of the settings for a Dynamic Dropdown from a delimited list

The options in the list are delimited by the character you designate as the Delimiter. The default delimiter is the vertical bar or pipe symbol as shown in the examples. You should make sure that the delimiter character you choose doesn’t appear in the text for any of the options since it will break these options into two. You can use any character as the delimiter except space.

Example: You have access to all the three-letter ISO-3166-1 alpha-3 country codes in a delimited list and you want to use them in a Dynamic Dropdown widget.

ABW|AFG|AGO|AIA|ALA|ALB|AND|ARE|ARG|ARM|...

Paste the list into any cell in the spreadsheet, designate this cell as the Options Range, assign a cell name and you have created a country code selector.

Use a prompt when a choice is required

With dropdowns you often want a prompt as the initial selection, e.g. Please select your country code in the example above. In this case, you place the prompt at the beginning of the list as in the example below. If you want to make country code selection mandatory, you can just verify that the dropdown is no longer returning the prompt before you allow the Wrap to be signed.

Please select your country code|ABW|AFG|AGO|AIA|ALA|ALB|AND|ARE|ARG|ARM|...

Leading and trailing blanks are removed

Options in the list are automatically truncated for leading and trailing blanks, e.g. if the list contains

...FLK |  FRA      | FRO...

the corresponding option in the dropdown will appear as just “FLK”, “FRA”, and “FRO”.

Known issues

  • When you open a saved wrap instance, it may have a previous value that is no longer included in the current definitions for the Dynamic Dropdown. Example: your company has railway cars in depots A, B and C. Depot C is then closed and all its cars are moved to other depots. All the cars previously belonging to depot C now have an invalid “home depot” setting. It must be possible to use these cars in ExcelWraps without locking the user out because of the invalid setting. If you open the wrap instance that describes one of these cars, depot C will be automatically added to the list of eligible choices for the Dynamic Dropdown and preselected when the wrap instance is opened. This behavior makes it possible to edit and submit the wrap instance with other changes without having to wait for the home depot settings to be updated.
  • If a cell within the options list has a currency format, this number format is not retained when displaying the dropdown. This is a known error and will be corrected in a future version.