{"title":"Design details: Searching for dimension combinations","url":"https://jonas-paprotka.de/docs/design-details-searching-for-dimension-combinations/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/design-details-searching-for-dimension-combinations, MicrosoftDocs/dynamics365smb-docs at 46907ac (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/design-details-searching-for-dimension-combinations","source":{"name":"Business Central application docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-docs","commit":"46907ace177f8d31deba47a2fdb57c3336e66252","date":"2026-11-19"},"checked":"2026-11-19","description":"When you close a page after you edit a set of dimensions, Business Central evaluates whether the edited set of dimensions exists. If the set does not exist, a new set is created and the dimension combination ID is returned.","date":"2026-03-17","meta":{"topic":"how-to"},"outline":[{"level":2,"title":"Building a search tree","slug":"building-a-search-tree","at":224,"chars":2605},{"level":3,"title":"Example 1","slug":"example-1","at":776,"chars":484},{"level":3,"title":"Example 2","slug":"example-2","at":1260,"chars":410},{"level":3,"title":"Finding the dimension set ID","slug":"finding-the-dimension-set-id","at":1670,"chars":1159},{"level":2,"title":"Related information","slug":"related-information","at":2829,"chars":267}],"text":"When you close a page after you edit a set of dimensions, Business Central evaluates whether the edited set of dimensions exists. If the set does not exist, a new set is created and the dimension combination ID is returned.\n## Building a search tree\nTable 481 Dimension Set Tree Node is used when Business Central evaluates whether a set of dimensions already exists in table 480 Dimension Set Entry table. The evaluation is performed by recursively traversing the search tree starting at the top level numbered 0. The top level 0 represents a dimension set with no dimension set entries. The children of this dimension set represent dimension sets with only one dimension set entry. The children of these dimension sets represent dimension sets with two children, and so on.\n### Example 1\nThe following diagram represents a search tree with six dimension sets. Only the distinguishing dimension set entry is displayed in the diagram.\n![Example of dimension tree structure.]\nThe following table describes a complete list of dimension set entries that make up each dimension set.\nDimension Sets|Dimension Set Entries\nSet 0|None\nSet 1|AREA 30\nSet 2|AREA 30, DEPT ADM\nSet 3|AREA 30, DEPT PROD\nSet 4|AREA 30, DEPT ADM, PROJ VW\nSet 5|AREA 40\nSet 6|AREA 40, PROJ VW\n### Example 2\nThis example shows how Business Central evaluates whether a dimension set that consists of the dimension set entries AREA 40, DEPT PROD exists.\nFirst, Business Central also updates the Dimension Set Tree Node table to make sure that the search tree looks like the following diagram. Thus dimension set 7 becomes a child of the dimension set 5.\n![Example of dimension tree structure in NAV 2013.]\n### Finding the dimension set ID\nAt a conceptual level, Parent ID, Dimension, and Dimension Value, in the search tree, are combined and used as the primary key because Business Central traverses the tree in the same order as the dimension entries. The GET function (record) is used to search for dimension set ID. The following code example shows how to find the dimension set ID when there are three dimension values.\n```\nDimSet.\"Parent ID\" := 0;  // 'root'\nIF UserDim.FINDSET THEN\n  REPEAT\n      DimSet.GET(DimSet.\"Parent ID\",UserDim.DimCode,UserDim.DimValueCode);\n  UNTIL UserDim.NEXT = 0;\nEXIT(DimSet.ID);\n\n```\nHowever, to preserve the ability of Business Central to rename both a dimension and a dimension value, table 349, Dimension Value, is extended with an integer field, Dimension Value ID. This table converts the field pair, Dimension and Dimension Value, to an integer value. When you rename the dimension and dimension value, the integer value is not changed.\n```\nDimSet.\"Parent ID\" := 0;  // 'root'\nIF UserDim.FINDSET THEN\n  REPEAT\n      DimSet.GET(DimSet.ParentID,UserDim.\"Dimension Value ID\");\n  UNTIL UserDim.NEXT = 0;\nEXIT(DimSet.ID);\n\n```\n## Related information\ndesign-details-dimension-set-entries-overview\ndesign-details-dimension-set-entries-overview\ndesign-details-table-structure\nFind free e-learning modules for Business Central here<https://learn.microsoft.com/training/dynamics365/business-central>"}