Tree Tool
The Tree tool displays an organized, hierarchical data structure in an app or macro. The selections made by the 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 that can accept a list of Allocate datasets. See the Allocate Tree Data Sources below for more information.
Configure the tool
- Enter the text or question to be displayed: The text presented to the app user defining how to use the Tree control.
- Tree Data Source: Location from which the hierarchy is pulled. Configuration options are under Properties.
- Single Selection: When checked, the App user can only select one tree value.
- 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.
-
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.
-
Properties: Values change depending on the selected Tree Data Source. Select the related data source for more information.
Allocate GeographyConfigure 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 will be returned in XML format and must be updated via an Update XML action.
- Save Values as Allocate Workspace Snippet: Values will be returned as an Allocate Workspace Snippet and will need to be updated accordingly through a valid action.
To display a drop down list of available Allocate datasets to the user, connect a Drop Down Tool to the input connector of the Tree tool, and set List Values to 'Allocate Datasets'.
Allocate VariablesConfigure 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 will be returned in XML format and must be updated via an Update XML action.
- Save Values as Allocate Workspace Snippet: Values will be returned as an Allocate Workspace Snippet and will need to be updated accordingly through a valid action.
To display a drop down list of available Allocate datasets to the user, connect a Drop Down Tool to the input connector of the Tree tool, and set List Values to 'Allocate Datasets'.
Show Field Names: Tree elements display field names.
File System DirectoryConfigure 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.
- Root Path: Browse to the directory.
-
Wild Card: Set a wild card to limit file display.
*.yxdb displays all .yxdb files found in the specified Root Path.
Custom XMLConfigure the custom list of options from an .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.
Formatting custom xml<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 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/DatabaseConfigure 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 filesThe 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 Anahiem 12 01020103 Buena Park