Skip to main content

Tree Tool Tree Tool

One Tool Example

Tree has a One Tool Example. Go to Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

Use Tree to display an organized, hierarchical data structure in an app or macro. The selections made by the end-user are passed as values to downstream tools. The values returned from trees are separated by a new line character (\n).

This tool has an optional input connector Q that can accept a list of Allocate datasets. See the Allocate Tree Data Sources below for more information.

Configure the Tool

  1. Enter the text or question to be displayed: The text presented to the app user defining how to use the Tree control.

  2. Tree Data Source: Location from which the hierarchy is pulled. Configuration options are under Properties.

  3. Single Selection: When checked, the App user can only select one tree value.

  4. Tree Window Height (Lines): Set the number of lines to display at once to a user. If more options are available, a scroll slider appears.

  5. Limit Tree Selection: Select to access the Filter Options window, which displays the entire available tree. Select the tree elements to display to the App user.

    • To include all child options, select the parent element.

    • To use this option with Allocate trees, select Use a specific Dataset. Set which parent levels of the tree to display:

      • Automatically decide which parent levels to display: The highest of the selected levels of the tree are displayed. When all children values of a parent are selected, the parent is displayed.

      • Show all parent levels of the tree: All parent levels of the selected tree are displayed.

  6. Properties: Values change depending on the selected Tree Data Source. Select the related data source for more information.

Allocate Geography

Configure the list of Allocate Geographies displayed to the App user.

Select what dataset is displayed:

  • Take Dataset from Allocate Dataset List: Displays all datasets installed on the App Consumer's machine for selection.

  • Use a Specific Dataset: Displays only the specified dataset. The App Consumer must have the dataset specified in order to choose an Allocate Geography.

Select how values are saved:

  • Save Values as XML: Values are returned in XML format and must be updated via an Update XML action.

  • Save Values as Allocate Workspace Snippet: Values are returned as an Allocate Workspace Snippet and need to be updated accordingly through a valid action.

To display a dropdown list of available Allocate datasets to the user, connect a Drop Down tool to the input connector Q of the Tree tool, and set List Values to 'Allocate Datasets'.

Allocate Variables

Configure the list of Allocate Variables displayed to the App user.

Select what dataset is displayed:

  • Take Dataset from Allocate Dataset List: Displays all datasets installed on the App Consumer's machine for selection.

  • Use a Specific Dataset: Displays only the specified dataset. The App Consumer must have the dataset specified in order to choose an Allocate Geography.

Select how values are saved:

  • Save Values as XML: Values are returned in XML format and must be updated via an Update XML action.

  • Save Values as Allocate Workspace Snippet: Values are returned as an Allocate Workspace Snippet and need to be updated accordingly through a valid action.

To display a dropdown list of available Allocate datasets to the user, connect a Drop Down tool to the input connector Q of the Tree tool, and set List Values to 'Allocate Datasets'.

Show Field Names: Tree elements display field names.

File System Directory

Configure the list of a system directory's files displayed to the App user. This control returns files. Directories are not selectable. Empty directories are not displayed.

  1. Root Path: Browse to the directory.

  2. Wild Card: Set a wild card to limit file display.

*.yxdb displays all .yxdb files found in the specified Root Path.

Custom XML

Configure the custom list of options from a .xml file displayed to the App user.

Custom XML Path: Browse to the .xml file. The path must be updated if the .xml file is moved.

   <AlteryxTree>

        <!-- Parent name is Crops -->
        <v n="Crops" k="01">
        
                <!-- The displayed child name is "Wheat" -->
                <v n="Wheat" k="0111">
                </v>
                
                <!-- The returned value is "0112" -->
                <v n="Rice" k="0112">
                </v>
                
                <!-- This child is not selectable and displays a red X -->
                <v n="Corn" k="0115" l="F">
                </v>
                
                <!-- This child is not selectable and displays a grey X -->
                <v n="Soybeans" x="0116">
                </v>
        </v>
</AlteryxTree>

v: Element. Required.

n: Name that will be displayed. Required.

k: Value of the element. Required if the node is selectable.

l: Set to "F" to make the element unselectable with a red X.

Any value assignment other than k or l will disable the selection with a grey X.

Values are returned separated by a new line.

Custom File/Database

Configure the list from a custom file or database displayed to the App user.

File/Database Path/Connection: Browse to the database file. All known file types are supported. The path must be updated if the database file is moved.

Key Field: Select the Key field for the database. The Key field must be unique per record. The hierarchy is established based on the value of the Key field.

Description Field: Select the Description field for the database. The Description is displayed as the element name to the App user.

Formatting Custom Files

The following file format creates a tree structure for Country > State > County > City. The Key has two digits for each level, stacked in sequence and increasing incrementally for each option. The value resets for each new branch.

Record number

Key

Description

1

01

USA

2

0101

Colorado

3

010101

Boulder

4

01010101

Louisville

5

01010102

Superior

6

01010103

Boulder

7

01010104

Gunbarrel

8

0102

California

9

010201

Orange County

10

01020101

Irvine

11

01020102

Anaheim

12

01020103

Buena Park