{"id":28003,"date":"2017-06-16T14:16:49","date_gmt":"2017-06-16T06:16:49","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=28003"},"modified":"2024-01-17T10:47:59","modified_gmt":"2024-01-17T02:47:59","slug":"ddgetattributes","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddgetattributes\/","title":{"rendered":"DDGetAttributes()"},"content":{"rendered":"\n<h2>Format<\/h2>\n<p class=\"intro-text\"><strong>DDGetAttributes(Entity Names, Attribute [,Entity Name Format])<\/strong><\/p>\n<h2>Returns<\/h2>\n<p class=\"intro-text\">Returns the values of the given attribute in a single collection for one or more entities, within the time range of the request.<\/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>EntityNames: <\/b>A single value or a collection of values, where each value contains the entity name as metadata (see <a href=\"#Useful_to_Know\">Useful to Know<\/a> below). If a single string is passed as this parameter, then the function assumes that this string is the name of an entity and will not search for additional metadata, however all other single values throw an exception. \u00a0Note: Typically a DDGetEntities() call is used to provide the list of entities. Since DDGetAttributes() provides the necessary entity name metadata on the return values, these functions can also be nested.\u00a0If the DD() function returns an error value, the error will be returned as is. If it returns Boolean values, the attribute will be fetched only if the value is true. In all other cases (date time, decimal, duration, integer, null, string) the attribute will be fetched.\u00a0<br \/>\nBehaviour: Required<br \/>\nDimensions: Error, Collection, SingleValue, MultiCollection<br \/>\nValid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration, Error<\/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>EntityNameFormat: <\/b>A format string which can be used to alter the name of entities. <em><strong>#entity#<\/strong><\/em> defines the name of the entity, and any other characters in the string will be concatenated verbatim. E.g. \"<em>prefix #entity# suffix<\/em>\" will produce an entity name of \"<em>prefix entityname suffix<\/em>\".<br \/>\nBehaviour: Optional<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>Useful to Know<\/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>Examples<\/h2>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes({ListOfTags}, 1, \":Attribute\")<\/span><br \/>\nResult: Returns an error, as a simple list of tags does not have associated metadata.<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(\"myEntity\", \"[myTemplate]:myAttribute!myAttributeValue\")<\/span><br \/>\nDescription: This function call behaves very similarly to a normal data object fetch like: {myEntity[myTemplate]:myAttribute!myAttributeValue}<br \/>\nResult: Returns the value of \"myAttributeValue\" on \"myAttribute\" on \"myTemplate\" of \"myEntity\"<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(DDGetEntities(\"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\">DDGetAttributes(DDGetAttributes(DDGetEntities(\"myHierarchy\", 2, \"rootEntity\"), \":myAttribute\") &gt; 15, \":myAttribute2\")<\/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=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(DDGetEntities(\"myHierarchy\", 1, \"Field 1\"), \":Oil Production\", \"P2 #entity#\")<\/span><br \/>\nResult: Returns the values for {P2 Well 1:Oil Production}, \u00a0{P2 Well 2:Oil Production}, and \u00a0{P2 Well 3:Oil Production}.<\/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\">DDGetAttributes(\"Archer\",\"[Oil Producing Well]:Choke\")<br \/>\n<\/span>Returns: The current choke position of well \"Archer\".<br \/>\nResult: <span style=\"color: #0000ff;\">8.9660510928212<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(\"Western Australia\",\"[Business Unit]:Oil Production!Daily Production\")<br \/>\n<\/span>Returns: The daily oil production for Western Australia business unit.<br \/>\nResult: <span style=\"color: #0000ff;\">82.6973713388189<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(DDGetEntities(\"P2 Corporate\", 3,\"\",\"Business Unit\"),\"[Business Unit]:Oil Production!Daily Production\")<br \/>\n<\/span>Returns: The daily oil production of all business units in the P2 Corporate hierarchy.<br \/>\nResult: <span style=\"color: #0000ff;\">70.2447172581426<\/span>\u00a0<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(DDGetEntities(\"P2 Corporate\", 5,\"Western Australia\",\"Oil Producing Well\"),\"[Oil Producing Well]:Status\")<br \/>\n<\/span>Returns: The status of all Oil Producing Wells in Western Australia, in the P2 Corporate hierarchy.<br \/>\nResult: <span style=\"color: #0000ff;\">81.5040183167458<\/span>\u00a0\u00a0<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">DDGetAttributes(DDGetAttributes(DDGetEntities(\"P2 Corporate\", 5, \"Western Australia\", \"Oil Producing Well\"), \"[Oil Producing Well]:Status\") == 0, \":Oil Production\")<br \/>\n<\/span>Returns: The total oil production of all Oil Producing Wells in Western Australia, in the P2 Corporate hierarchy, where the status of the well is 0.<br \/>\nResult: <span style=\"color: #0000ff;\">16.3614824024781<\/span> \u00a0<\/p>\n<h2><span id=\"Release_History\">Release History<\/span><\/h2>\n<ul class=\"intro-text\">\n<li>DDGetAttributes() 4.6.5\n<ul class=\"intro-text\">\n<li>Changed EntityNames parameter to support MultiCollection values.<\/li>\n<\/ul>\n<\/li>\n<li>DDGetAttributes() 4.5.0\n<ul class=\"intro-text\">\n<li>Initial version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Returns the value of the given attribute in a single collection for one or more entities.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/ddgetattributes\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":28049,"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-28003","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\/28003","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=28003"}],"version-history":[{"count":3,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28003\/revisions"}],"predecessor-version":[{"id":64704,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/28003\/revisions\/64704"}],"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\/28049"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=28003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=28003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=28003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}