Setting Choices for Tree Controls


A data field displayed as a tree control or drop-down tree control accepts only values that are in its choice list. These images show a tree control in regular and drop-down formats.

  1. Select the control, choose Object > Properties and display the Setup tab.

  2. Select "List Box" or "Tree Control" in the Field-Type list.

  3. Display the Choices tab.

  4. Select one of the Choices for control. The options are:

    • " User Defined "

    • " Computed Automatically "

    • " Populated using Xbasic "

  5. User Defined Choices

    If you selected "User Defined" in step 4: Enter choices one per line in the following format. Note that you use a period "." to step down to the next level. A tree control may have up to 9 levels.

  6. Optionally, click 'AZ up' or 'ZA down' to sort the entries in ascending or descending order.

  7. Click OK to save your choices definition.

  8. If you selected "Computed Automatically" in step 4, make a selection from the Source list. The options are:

    • 1. " Values from a table/set "

    • 2. " Expression (that returns a CR-LF delimited list) "

  9. Populated Using Xbasic

    If you selected "Populated Using Xbasic" in step 4: Right click the form and select Events > OnInit.

  10. Add a statement with the following format.

    TreeControlName.settings.dynamic_list =
    The must return a CR-LF delimited list with periods between the field values.

Values from a Table/Set

If you selected "Values from a table/set" in step 8:

  1. Make a selection from the From Table list.

  2. Enter an expression in the Field/expression control. Optionally, select "" to display the Expression Builder to help you define the expression. Note that the expression should in the following format to create branches for the tree.

    value1 + "." + value2 + "." + value3
  3. Optionally, click the 'up down' icon to display the Order Builder to order the list choices that will appear.

  4. A filter expression selects values from a lookup table based on one or more values in the current table. Optionally check Enable Filter Expression and click Edit Filter Expression to display the Filter Expression dialog box.

  5. Optionally, check Display only unique keys to avoid duplicate entries in the list.

  6. Optionally, click Preview to see the data that the list will contain.

  7. Click OK to save your choices.

CR-LF Delimited List

If you selected "Expression (that returns a CR-LF delimited list)" in step 8:

  1. In the Expression field enter a call to a function or script that returns a list of CR-LF delimited values. Optionally, click to display the Expression Builder dialog box. Note that the each line of data returned should be in the following format to create branches for the tree.

  2. Optionally, enter an expression in the Watch Expression field. When this value changes, Alpha Anywhere will refresh the choice list.

  3. Optionally, click Preview to see the data that the list will contain.

  4. Click OK to save your choices.

See Also