{"id":1802,"date":"2024-02-02T09:10:45","date_gmt":"2024-02-02T09:10:45","guid":{"rendered":"https:\/\/www.greytrix.com\/blogs\/acumatica\/?p=1802"},"modified":"2024-12-02T05:50:52","modified_gmt":"2024-12-02T05:50:52","slug":"acumatica-attributes-in-dac-code","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/","title":{"rendered":"Acumatica Attributes in DAC Code"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.greytrix.com\/acumatica-cloud-erp\/\" target=\"_blank\" rel=\"noreferrer noopener\">Acumatica <\/a>provides a powerful framework for creating and customizing data structures through the use of Data Access Classes (DACs). One of the key features that contribute to the flexibility and extensibility of Acumatica data structures is the use of attributes.<\/p>\n\n\n\n<p>In this blog post, we will dive into the world of Acumatica attributes used in DAC code, exploring their significance and types. Let&#8217;s see how attributes enhance the definition and behavior of DAC fields.<\/p>\n\n\n\n<p><strong>Attributes:<\/strong><\/p>\n\n\n\n<p>Attributes in <a href=\"https:\/\/www.greytrix.com\/acumatica-cloud-erp\/\" target=\"_blank\" rel=\"noreferrer noopener\">Acumatica<\/a> are metadata tags applied to DAC fields, providing additional information about how the field should be treated or presented. They impact various aspects, including user interface rendering, validation rules, and database interactions.<\/p>\n\n\n\n<p><strong>Commonly Used Attributes<\/strong><\/p>\n\n\n\n<p><strong>1. PXDBString<\/strong><\/p>\n\n\n\n<p>The `PXDBString` attribute defines a string field in the database. It allows you to specify the maximum length, whether the field is a key, and whether it should be stored as Unicode.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>&nbsp;[PXDBString(30, IsUnicode = true, InputMask = &#8220;&#8221;)] [PXUIField(DisplayName = &#8220;Customer ID&#8221;)]<\/p>\n\n\n\n<p><strong>2. PXDefault<\/strong><\/p>\n\n\n\n<p>The `PXDefault` attribute sets the default value for a field. This is useful for fields that should have a predefined value when a new record is created.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>[PXDefault(&#8220;NEW&#8221;)]<\/p>\n\n\n\n<p>[PXDBString(2, IsFixed = true)]<\/p>\n\n\n\n<p>[PXUIField(DisplayName = &#8220;Status&#8221;)]<\/p>\n\n\n\n<p><strong>3. PXUIField<\/strong><\/p>\n\n\n\n<p>The `PXUIField` attribute controls the appearance and behavior of fields in the user interface, including labels, visibility, and enabled\/disabled states.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>[PXUIField(DisplayName = &#8220;Customer Name&#8221;, Visibility = PXUIVisibility.SelectorVisible)]<\/p>\n\n\n\n<p>[PXDBString(60, IsUnicode = true)]<\/p>\n\n\n\n<p><strong>4. PXSelector<\/strong><\/p>\n\n\n\n<p>The `PXSelector` attribute associates a field with a selector control, providing a list of values for the user to choose from.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>[PXSelector(typeof(Search&lt;InventoryItem.inventoryID&gt;))]<\/p>\n\n\n\n<p>[PXDBInt]<\/p>\n\n\n\n<p>[PXUIField(DisplayName = &#8220;Inventory ID&#8221;)]<\/p>\n\n\n\n<p>&nbsp;<strong>Advanced Attributes<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PXFormula<\/strong><\/li>\n<\/ul>\n\n\n\n<p>The `PXFormula` attribute allows you to define calculated fields based on formulas involving other fields within the DAC.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>[PXFormula(typeof(Switch&lt;Case&lt;Where&lt;Current&lt;SOOrder.orderQty&gt;, Equal&lt;decimal0&gt;&gt;, int1&gt;, int0&gt;))]<\/p>\n\n\n\n<p>[PXInt]<\/p>\n\n\n\n<p>[PXUIField(DisplayName = &#8220;Zero Quantity Flag&#8221;)]<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PXDimensionSelector<\/strong><\/li>\n<\/ul>\n\n\n\n<p>The `PXDimensionSelector` attribute provides a specialized selector for dimension fields, ensuring adherence to dimension rules.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>[PXDimensionSelector(INItemSite.dimension, typeof(Search&lt;DimensionValue.valueID, Where&lt;DimensionValue.dimensionID, Equal&lt;INItemSite.dimension&gt;&gt;, OrderBy&lt;Asc&lt;DimensionValue.sortOrder&gt;&gt;&gt;), typeof(DimensionValue.valueID))]<\/p>\n\n\n\n<p>[PXDBString(30, IsUnicode = true)] [PXUIField(DisplayName = &#8220;Location ID&#8221;)]<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Acumatica provides a powerful framework for creating and customizing data structures through the use of Data Access Classes (DACs). One of the key features that contribute to the flexibility and extensibility of Acumatica data structures is the use of attributes. In this blog post, we will dive into the world of Acumatica attributes used in\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[146,15,3,130,14],"tags":[4,16,88,147,242,244],"class_list":["post-1802","post","type-post","status-publish","format-standard","hentry","category-acumatica","category-acumatica-customization","category-acumatica-erp","category-acumatica-product","category-acumatica-services","tag-acumatica","tag-acumatica-erp","tag-attributes","tag-customization","tag-dac","tag-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components<\/title>\n<meta name=\"description\" content=\"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.\" \/>\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.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"og:description\" content=\"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Acumatica \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-02T09:10:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-02T05:50:52+00:00\" \/>\n<meta name=\"author\" content=\"Greytrix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Greytrix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\",\"name\":\"Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/#website\"},\"datePublished\":\"2024-02-02T09:10:45+00:00\",\"dateModified\":\"2024-12-02T05:50:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/552ee972453444bfd83035b7b7c1a407\"},\"description\":\"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Acumatica Attributes in DAC Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/\",\"name\":\"Acumatica \u2013 Tips, Tricks and Components\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/552ee972453444bfd83035b7b7c1a407\",\"name\":\"Greytrix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"Greytrix\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/acumatica\/author\/acumatica\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components","description":"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.","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.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/","og_locale":"en_US","og_type":"article","og_title":"Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components","og_description":"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.","og_url":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/","og_site_name":"Acumatica \u2013 Tips, Tricks and Components","article_published_time":"2024-02-02T09:10:45+00:00","article_modified_time":"2024-12-02T05:50:52+00:00","author":"Greytrix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Greytrix","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/","url":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/","name":"Acumatica Attributes in DAC Code - Acumatica \u2013 Tips, Tricks and Components","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/#website"},"datePublished":"2024-02-02T09:10:45+00:00","dateModified":"2024-12-02T05:50:52+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/552ee972453444bfd83035b7b7c1a407"},"description":"Acumatica attributes at DAC code level provides customization and extensibility capabilities of the Acumatica ERP system.","breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/2024\/02\/02\/acumatica-attributes-in-dac-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/acumatica\/"},{"@type":"ListItem","position":2,"name":"Acumatica Attributes in DAC Code"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/#website","url":"https:\/\/www.greytrix.com\/blogs\/acumatica\/","name":"Acumatica \u2013 Tips, Tricks and Components","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/acumatica\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/552ee972453444bfd83035b7b7c1a407","name":"Greytrix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/acumatica\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"Greytrix"},"url":"https:\/\/www.greytrix.com\/blogs\/acumatica\/author\/acumatica\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/posts\/1802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/comments?post=1802"}],"version-history":[{"count":5,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/posts\/1802\/revisions"}],"predecessor-version":[{"id":3047,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/posts\/1802\/revisions\/3047"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/media?parent=1802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/categories?post=1802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/acumatica\/wp-json\/wp\/v2\/tags?post=1802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}