- 12 Mar 2021
- 2 Minutes to read
- Print
- DarkLight
Creating Tree View Format
- Updated on 12 Mar 2021
- 2 Minutes to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.9.2 |
Root Folder | Example Lab - Tree View Format |
Modules | None |
Dependencies | None |
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.