Creating Tree View Format
  • 12 Mar 2021
  • 2 Minutes to read
  • Dark
    Light

Creating Tree View Format

  • Dark
    Light

Article summary

Example Lab Article
While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released.


Overview

Example Lab Details

Version6.9.2
Root FolderExample Lab - Tree View Format
Modules None
DependenciesNone

This Example Lab project demonstrates how to create a list displayed in tree view format.


Explanation

This project works by gathering two lists as input from the user. The first list represents companies and the second represents the managers of those companies. There is a unit test provided in the debugger for ease of use.

Note: If the user decides to input their own lists it must follow this format. Only the company name in the companies list and the company name followed by the employee name in the managers list. ( 1st list - [company name] 2nd list [comapny name]: [manager name]) See the unit test for an example

These two lists are then run through two ForEach steps. The first loop iterates through the company names sending each company name individually to start the next ForEach loop which iterates through the list of managers. In order to ensure each manager is associated with the correct parent company the ForEach loop that iterates through the list of managers has a Rule that checks if the current company name list item is contained in the manager name list item. Upon finding the matching manager list item for the current company list item that value is then passed into the Merge to Plain String step

The Merge to Plain String step combines the company list item with the manager list item separated by a "/" character. This step is important because the tree view Form component requires the "/" character to separate the parent and child node. The output from the Merge to Plain String step is then passed into the Add Item to List step, where each item is added to the "New List". 

Once the ForEach loops have cycled through the entirety of each list the "New List" created by the Add Item to List step is passed into the Tree View Form component. The "New List" data is then used to populate the Tree View component.

Reference Articles



Project Download

The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 6.9.2 or later using our Importing/Exporting article.





Was this article helpful?