{"id":28002,"date":"2017-06-16T14:16:52","date_gmt":"2017-06-16T06:16:52","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=28002"},"modified":"2026-03-10T13:27:36","modified_gmt":"2026-03-10T05:27:36","slug":"ddget","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddget\/","title":{"rendered":"DDGet()"},"content":{"rendered":"\n<h2>Format<\/h2>\n<p class=\"intro-text\"><strong>DDGet(Hierarchy ,Depth ,Starting Entity ,Attribute [,Condition] [,Templates])<\/strong><\/p>\n<h2>Returns<\/h2>\n<p class=\"intro-text\">Returns the value of the specified attribute of each matching child\/parent entity in the specified hierarchy, in a single collection.<\/p>\n<p class=\"left-bar-yellow\">It is possible to retrieve very large volumes of data through indiscriminate use of this function. Retrieving large amounts of Historian data across a slow network can affect system performance for all users of the system.<\/p>\n<h2>Inputs<\/h2>\n<p class=\"intro-text\"><b>Hierarchy: <\/b>The name of the hierarchy in which to search.\u00a0<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>Depth<\/b>: The maximum number of levels to traverse in the hierarchy. Negative numbers indicate parent entities and positive numbers indicate child entities. E.g. 1 returns all immediate children, 2 returns all children and grandchildren, -1 returns all immediate parents, -2 returns all parents and grandparents.<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: Integer<\/p>\n<p class=\"intro-text\"><b>Starting Entity<\/b>: The name of the entity at which to start the search.\u00a0<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>Attribute<\/b>: The attribute or attribute value to fetch for each entity. The format must follow the syntax used for fetching data objects (i.e. <span class=\"code-fragment\">[TemplateName]:Attribute!AttributeValue<\/span>). The entity name is provided by the first parameter. If the [<em>TemplateName<\/em>] is omitted, the function will assume the attribute belongs to the entity's primary template.\u00a0<br \/>\nBehaviour: Required<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>Condition: <\/b>A condition which filters the list of entities to fetch data for. Attribute names can be specified in the condition using the data object fetch syntax, but without entity names as entities will be provided by metadata e.g. <span class=\"code-fragment\">{[myTemplate]:myAttribute!myAttributeValue} &gt; 15<\/span>. If the condition is omitted, the function returns the values for all entities.<br \/>\nBehaviour: Optional<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>Templates<\/b>: List of template names that the returned entities must have assigned, within the time range of the fetch request. If an entity does not have one of these templates assigned, it will not appear in the results.\u00a0If the template filter is omitted, the fetch will be attempted on all entities (regardless of template) and errors will be returned if the entities don\u2019t have the attribute specified in the 4th parameter.<br \/>\nBehaviour: Optional (0..n)<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"left-bar\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/calculation-syntax\/#Data_Type\">How to format data types<\/a><\/p>\n<h2><span id=\"Useful_to_Know\">Useful to Know<\/span><\/h2>\n<p class=\"intro-text\">In the calculation engine, values returned by DD() functions have metadata assigned to them, such as entity name and start\/end times. Other DD() functions can use this metadata to assign additional information to values they receive. In this way, the metadata is used by nested DD() functions to reduce complexity but increase versatility. Which metadata is used and how it is used is specific to each function, and is described in the Input Values section above, where applicable.<\/p>\n<h2><span id=\"When_to_Use\">When to Use<\/span><\/h2>\n<p class=\"intro-text\">This function can be used in place of a nested <span class=\"code-fragment\">DDGetAttributes(DDGetEntities)<\/span> function.<\/p>\n<ul class=\"intro-text\">\n<li>Use <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddgetattributes\/\">DDGetAttributes<\/a>() to fetch the values of an entity attribute.<br \/>\nUse <strong>DDGet<\/strong>() to fetch the values of an entity attribute, when a condition is met and\/or you want to filter by a particular template.<br \/>\n\u00a0<\/li>\n<li>Use <strong>DDGet<\/strong>() to fetch the <em>values<\/em> of an entity attribute.<br \/>\nUse <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddgetentities\/\">DDGetEntities<\/a>() to get the <em>names<\/em> of the entities.<\/li>\n<\/ul>\n<h2>Examples<\/h2>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGet(\"myHierarchy\", 2, \"rootEntity\", \":myAttribute\")<\/span><br \/>\nResult: Returns the value of \"myAttribute\" for each child entity maximum 2 levels below the \"rootEntity\" in \"myHierarchy\".<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGet(\"myHierarchy\", 2, \"rootEntity\", \":myAttribute2\", \"{:myAttribute} &gt; 15\")<\/span><br \/>\nResult: Returns the value of \"myAttribute2\" for each child entity maximum 2 levels below the \"rootEntity\" in \"myHierarchy\" where the value of \"myAttribute\" is greater than 15.<\/p>\n<p class=\"left-bar\">Tip: If you have access to the sample data, try running the following examples using the <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/configuring-your-system\/creating-a-calculation\/using-the-calculation-tester\/\">calculation tester<\/a>.\u00a0<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGet(\"P2 Corporate\", 5, \"Western Australia\", \":Oil Production\", \"{[Oil Producing Well]:Status} == 0\", \"Oil Producing Well\")<br \/>\n<\/span>Returns: The total oil production of each Oil Producing Well in Western Australia, in the P2 Corporate hierarchy, where the well is online (status is 0). This is effectively the same as the function\u00a0<span class=\"code-fragment\">DDGetAttributes(DDGetAttributes(DDGetEntities(\"P2 Corporate\", 5, \"Western Australia\", \"Oil Producing Well\"), \"[Oil Producing Well]:Status\") == 0, \":Oil Production\")<\/span>.<br \/>\nResult: <span style=\"color: #0000ff;\">24.8919960227292<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Returns the value of the specified attribute of each matching child\/parent entity in the specified hierarchy in a single collection.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddget\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":28048,"parent":3650,"menu_order":86,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[9],"tags":[100,282],"class_list":["post-28002","page","type-page","status-publish","has-post-thumbnail","hentry","category-tech-ref","tag-calculations","tag-data-dictionary","Version-4-5-0","Product-srv"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=28002"}],"version-history":[{"count":3,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28002\/revisions"}],"predecessor-version":[{"id":72005,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28002\/revisions\/72005"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/3650"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media\/28048"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=28002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=28002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=28002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}