{"id":2140,"date":"2020-07-11T12:30:56","date_gmt":"2020-07-11T17:30:56","guid":{"rendered":"https:\/\/www.teamdesk.net\/blog\/?p=2140"},"modified":"2021-09-28T08:04:57","modified_gmt":"2021-09-28T13:04:57","slug":"multi-level-tree","status":"publish","type":"post","link":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/","title":{"rendered":"Multi-level tree of related records"},"content":{"rendered":"\n<p>If a table contains nested records, it means that there is a multi-level tree of related records.<br>In this blogpost you may read how the multi-level tree of related records can be configured.<br>Let\u2019s assume that within your database you need to register and calculate energy consumption of engines containing modules and submodules. The structure would look like a multi-level tree including the following levels: Engine(Parent)-&gt;Modules(Children)-&gt;SubModules(Grandchildren). The number of levels may be unlimited. The goal is to calculate the total energy consumption from the lowest level to the highest. Besides, if the highest-level record is deleted, all the related records will be deleted automatically.<\/p>\n\n\n\n<p>You may order a free trial of the pre-built \u201cExample: Multi-Level Tree\u201d <a href=\"https:\/\/www.teamdesk.net\/multi_level_tree\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">database<\/a> to review the setup described below.<\/p>\n\n\n\n<p>This example contains a single table \u201cEngines\u201d. You may see this table structure on the screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"533\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-tree-1-1024x533.png\" alt=\"Multi-Lrevel Tree\" class=\"wp-image-2147\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-tree-1-1024x533.png 1024w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-tree-1-300x156.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-tree-1-768x399.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-tree-1.png 1419w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The multi-level tree has three levels: Engine-&gt;Modules-&gt;SubModules.<br>Building such a tree takes the following steps:<\/p>\n\n\n\n<p>1. First, you need a <a href=\"https:\/\/www.teamdesk.net\/help\/4.3.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">single-reference<\/a> column in the \u201cEngines\u201d table, while the table should refer to itself. One record is related to another the way a child is related to a parent. Each parent can be related to many children, while each child can be related to one parent. Let\u2019s name this reference column \u201cParent\u201d. In our example one Engine can be related to many Modules, while each Module can be related to many SubModules.<br>The \u201cParent\u201d single-reference column settings are shown on the screenshot below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"933\" height=\"921\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Parent-Reference-Column-2.png\" alt=\"Parent Reference column\" class=\"wp-image-2142\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Parent-Reference-Column-2.png 933w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Parent-Reference-Column-2-300x296.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Parent-Reference-Column-2-768x758.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Parent-Reference-Column-2-60x60.png 60w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/figure>\n\n\n\n<p>2. You should also create the \u201cOld Parent\u201d single-reference column. This column participates in workflow actions making records recounting. It is needed as an auxiliary column, therefore the \u201cOld Parent\u201d reference column should be hidden on the form and removed from views.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"924\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Old-Parent-Column.png\" alt=\"Old Parent Column\" class=\"wp-image-2143\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Old-Parent-Column.png 938w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Old-Parent-Column-300x296.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Old-Parent-Column-768x757.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Old-Parent-Column-60x60.png 60w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p>3.  In our example every engine or module or submodule has an energy consumption value, which is kept in the \u201cEnergy Consumption\u201d column. You would also need to calculate the energy consumption of related lower levels (Modules and SubModultes) and store this value within the Parent record, in the \u201cConsumption of Lower Levels\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.6.4.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">numeric column<\/a>. Also, the \u201cNeed Recalculate\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.6.9.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">checkbox column<\/a> should be created as it will be used for the assignments added to the workflow actions. You may see these three columns in the column list of the \u201cEngines\u201d table:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"555\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Columns-4.png\" alt=\"\" class=\"wp-image-2148\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Columns-4.png 1020w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Columns-4-300x163.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Columns-4-768x418.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<p>4.  Moreover, in the relation built by the \u201cParent\u201d reference column you would need to add two auxiliary columns that will be used in workflow actions. Firstly, lets create the \u201cCount Consumption of Lower Levels\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.5.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">summary column<\/a>. It summarizes Energy Consumption values stored in related lower level records. Secondly, you should add a <a href=\"https:\/\/www.teamdesk.net\/help\/4.17.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">RecordSet column<\/a>, let\u2019s name it \u201cLower Levels Recordset\u201d. This column displays internal record IDs of related lower level records.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"152\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Auxiliary-columns-5-1024x152.png\" alt=\"Multi-Level Tree Auxiliary Coulmns\" class=\"wp-image-2150\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Auxiliary-columns-5-1024x152.png 1024w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Auxiliary-columns-5-300x44.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Auxiliary-columns-5-768x114.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Auxiliary-columns-5.png 1384w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>5. The last column that is obligatory to be created is the \u201cTotal Energy Consumption\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.6.16.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">formula<\/a>-numeric column.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"171\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Formula-Column-6-1024x171.png\" alt=\"Formula Numeric Column\" class=\"wp-image-2152\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Formula-Column-6-1024x171.png 1024w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Formula-Column-6-300x50.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Formula-Column-6-768x128.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Formula-Column-6.png 1152w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>6. Now you can configure workflow triggers of the <a href=\"https:\/\/www.teamdesk.net\/help\/11.3.1.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">Record Change type<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"404\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Triggers.png\" alt=\"Workflow Triggers\" class=\"wp-image-2153\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Triggers.png 960w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Triggers-300x126.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Triggers-768x323.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<p>The main advantage is that these triggers work as a cascade due to the \u201cExecute Triggers\u201d option activated in the <a href=\"https:\/\/www.teamdesk.net\/help\/11.4.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">workflow actions<\/a> stored in these triggers. Therefore, if an Energy Consumption value is added or changed in a record of a lower level (for example in SubModule), the system recalculates the total energy consumption in higher levels, such as \u201cModule\u201d and \u201cEngine\u201d records in our example.<\/p>\n\n\n\n<p>7.  The first trigger is \u201cAdd\/Edit Trigger\u201d. It includes three actions of the <a href=\"https:\/\/www.teamdesk.net\/help\/11.4.2.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">Update Record type<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"830\" height=\"714\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Add-Edit-Trigger.png\" alt=\"Add or Edit Trigger\" class=\"wp-image-2154\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Add-Edit-Trigger.png 830w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Add-Edit-Trigger-300x258.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Add-Edit-Trigger-768x661.png 768w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/figure>\n\n\n\n<p>If a Parent value is changed in a record, the \u201cRecalculate Parent\u201d action initiates the request to recalculate the Energy Consumption for the Parent record.<\/p>\n\n\n\n<p>Therefore, the \u201ctrue\u201d value is set in the \u201cNeed Recalculate\u201d checkbox column.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"781\" height=\"516\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Parent-1.png\" alt=\"Recalculate Parent\" class=\"wp-image-2155\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Parent-1.png 781w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Parent-1-300x198.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Parent-1-768x507.png 768w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/figure>\n\n\n\n<p>The second action \u201cRecalculate Old Parent\u201d initiates the request to recalculate Energy Consumption for the Old Parent record.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"514\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Old-Parent-2.png\" alt=\"Recalculate Old Parent\" class=\"wp-image-2157\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Old-Parent-2.png 778w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Old-Parent-2-300x198.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Old-Parent-2-768x507.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/figure>\n\n\n\n<p>Please note that the \u201cExecute Triggers\u201d option is active in both of the above-mentioned actions.<\/p>\n\n\n\n<p>The third action is the \u201cUpdate Old Parent\u201d action. It is needed to update the Old Parent value by the Parent value after all recalculations had been made.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"528\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Update-Old-Parent-3.png\" alt=\"Update Old Parent\" class=\"wp-image-2158\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Update-Old-Parent-3.png 785w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Update-Old-Parent-3-300x202.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Update-Old-Parent-3-768x517.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<p>8. The \u201cRecalculate Trigger\u201d includes both the \u201cRecalculate Children\u201d action and the existing \u201cRecalculate Parent\u201d action described above.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"739\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-trigger-8.png\" alt=\"\" class=\"wp-image-2159\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-trigger-8.png 942w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-trigger-8-300x235.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-trigger-8-768x602.png 768w\" sizes=\"auto, (max-width: 942px) 100vw, 942px\" \/><\/figure>\n\n\n\n<p>The first \u201cRecalculate Children\u201d action assigns the \u201cCount Consumption of Lower Levels\u201d summary column value to the \u201cConsumption of Lower Levels\u201d numeric column. Also, it sets \u201cNeed Recalculate\u201d checkbox value to \u201cfalse\u201d. This last assignment is needed to stop the related details recalculation if such a recalculation is finished.<\/p>\n\n\n\n<p>The settings of the \u201cRecalculate Children\u201d action are displayed on the following screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"611\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Children.png\" alt=\"Recalculate Children Records\" class=\"wp-image-2161\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Children.png 773w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Children-300x237.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Recalculate-Children-768x607.png 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/figure>\n\n\n\n<p>The second action is the \u201cRecalculate Parent\u201d action which is also used in the \u201cAdd\/Edit Trigger\u201d.<br>This action is needed to initiate the recalculation of records on higher levels.<\/p>\n\n\n\n<p>9. \u201cDelete Trigger\u201d allows to delete all Children records when a Parent record is deleted. There are three actions in this trigger:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"715\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Trigger.png\" alt=\"Delete Trigger\" class=\"wp-image-2163\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Trigger.png 786w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Trigger-300x273.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Trigger-768x699.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>The first action is the \u201cDelete Children \u201d <a href=\"https:\/\/www.teamdesk.net\/help\/11.4.4.aspx\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">action<\/a>. It allows to delete related details listed in the \u201cLower Levels Recordset\u201d column when a Parent record is deleted.<br>\u201cExecute Triggers\u201d option is active in this action.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"448\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Children-Records.png\" alt=\"Delete Children Records\" class=\"wp-image-2164\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Children-Records.png 777w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Children-Records-300x173.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Delete-Children-Records-768x443.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/figure>\n\n\n\n<p>The second \u201cClear Parent\u201d action is needed to clear a Parent value within deleted records. It allows to exclude deleted record from recalculation of the energy consumption value within the Parent record.<\/p>\n\n\n\n<p>Deleted record may be restored from the Recycle Bin, however, a restored record will not be related to any Parent automatically since its Parent field is empty.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"522\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Clear-Parent-action-6.png\" alt=\"Clear Parent\" class=\"wp-image-2165\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Clear-Parent-action-6.png 786w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Clear-Parent-action-6-300x199.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Clear-Parent-action-6-768x510.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>The third \u201cRecalculate old Parent\u201d action is an existing action that also participates in the \u201cAdd\/Edit Trigger\u201d described in the item # 7. Due to this action the deletion is repeated from the lowest level to the highest.<\/p>\n\n\n\n<p>10. If you would like to review the described setup, please try the \u201cExample: Multi-Level Tree\u201d <a href=\"https:\/\/www.teamdesk.net\/multi_level_tree\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">template<\/a> from the database library.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here you may read how the multi-level tree of related records can be configured. For example such nested records: Engine(Parent)-> Modules(Children)-> SubModules(Grandchildren)<\/p>\n","protected":false},"author":3,"featured_media":2169,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[187,186,188,237],"class_list":["post-2140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-tricks","tag-multi-level-tree-2","tag-multi-level-tree","tag-multilevel-tree","tag-nested-records"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Multi-level tree of related records - TeamDesk Blog<\/title>\n<meta name=\"description\" content=\"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Multi-level tree of related records - TeamDesk Blog\" \/>\n<meta property=\"og:description\" content=\"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/\" \/>\n<meta property=\"og:site_name\" content=\"TeamDesk Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-11T17:30:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-28T13:04:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1034\" \/>\n\t<meta property=\"og:image:height\" content=\"479\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mila\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mila\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/\"},\"author\":{\"name\":\"Mila\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\"},\"headline\":\"Multi-level tree of related records\",\"datePublished\":\"2020-07-11T17:30:56+00:00\",\"dateModified\":\"2021-09-28T13:04:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/\"},\"wordCount\":951,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Multi-Level-Tree-2.png\",\"keywords\":[\"multi level tree\",\"multi-level tree\",\"multilevel tree\",\"nested records\"],\"articleSection\":[\"Tips &amp; Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/\",\"name\":\"Multi-level tree of related records - TeamDesk Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Multi-Level-Tree-2.png\",\"datePublished\":\"2020-07-11T17:30:56+00:00\",\"dateModified\":\"2021-09-28T13:04:57+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\"},\"description\":\"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Multi-Level-Tree-2.png\",\"contentUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Multi-Level-Tree-2.png\",\"width\":1034,\"height\":479,\"caption\":\"Multi-Level tree\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/multi-level-tree\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Multi-level tree of related records\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\",\"name\":\"TeamDesk Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\",\"name\":\"Mila\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"caption\":\"Mila\"},\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/author\\\/mila\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Multi-level tree of related records - TeamDesk Blog","description":"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/","og_locale":"en_US","og_type":"article","og_title":"Multi-level tree of related records - TeamDesk Blog","og_description":"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.","og_url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/","og_site_name":"TeamDesk Blog","article_published_time":"2020-07-11T17:30:56+00:00","article_modified_time":"2021-09-28T13:04:57+00:00","og_image":[{"width":1034,"height":479,"url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png","type":"image\/png"}],"author":"Mila","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mila","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#article","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/"},"author":{"name":"Mila","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e"},"headline":"Multi-level tree of related records","datePublished":"2020-07-11T17:30:56+00:00","dateModified":"2021-09-28T13:04:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/"},"wordCount":951,"commentCount":0,"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png","keywords":["multi level tree","multi-level tree","multilevel tree","nested records"],"articleSection":["Tips &amp; Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/","url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/","name":"Multi-level tree of related records - TeamDesk Blog","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#primaryimage"},"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png","datePublished":"2020-07-11T17:30:56+00:00","dateModified":"2021-09-28T13:04:57+00:00","author":{"@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e"},"description":"If a table contains nested records, it means that there is a multi-level tree of related records. In this blogpost we describe how the multi-level tree of related records can be configured. To review the described multi-level tree setup, try the \u201cExample: Multi-Level Tree\u201d template from the database library.","breadcrumb":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#primaryimage","url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png","contentUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2020\/07\/Multi-Level-Tree-2.png","width":1034,"height":479,"caption":"Multi-Level tree"},{"@type":"BreadcrumbList","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/multi-level-tree\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.teamdesk.net\/blog\/"},{"@type":"ListItem","position":2,"name":"Multi-level tree of related records"}]},{"@type":"WebSite","@id":"https:\/\/www.teamdesk.net\/blog\/#website","url":"https:\/\/www.teamdesk.net\/blog\/","name":"TeamDesk Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.teamdesk.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e","name":"Mila","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","caption":"Mila"},"url":"https:\/\/www.teamdesk.net\/blog\/author\/mila\/"}]}},"_links":{"self":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/2140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/comments?post=2140"}],"version-history":[{"count":16,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/2140\/revisions"}],"predecessor-version":[{"id":2501,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/2140\/revisions\/2501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media\/2169"}],"wp:attachment":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media?parent=2140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/categories?post=2140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/tags?post=2140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}