{"id":85,"date":"2018-02-23T10:40:24","date_gmt":"2018-02-23T10:40:24","guid":{"rendered":"http:\/\/coding.agust.org\/?p=85"},"modified":"2018-02-23T10:40:24","modified_gmt":"2018-02-23T10:40:24","slug":"ax-2012-dimension-sql-code-snippet","status":"publish","type":"post","link":"https:\/\/coding.agust.org\/index.php\/2018\/02\/23\/ax-2012-dimension-sql-code-snippet\/","title":{"rendered":"AX 2012 dimension sql code snippet"},"content":{"rendered":"<p>To fetch an AX 2012 dimension into a sql report it is sometimes a good choice to prepare a CTE for each dimension and then use the cte in the main query below:<\/p>\n<p>cteRegion as (<br \/>\nselect distinct v.partition, v.valuecombinationrecid, b.value, b.name<br \/>\nfrom DimAttributeOMBusinessUnit b<br \/>\nleft join dimensionattributelevelvalueallview v on<br \/>\nv.dimensionattribute = (select top 1 recid from dimensionattribute WHERE DIMENSIONATTRIBUTE.NAME = &#8216;Region&#8217;)<br \/>\nand v.entityinstance = b.recid)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To fetch an AX 2012 dimension into a sql report it is sometimes a good choice to prepare a CTE for each dimension and then use the cte in the main query below: cteRegion as ( select distinct v.partition, v.valuecombinationrecid, b.value, b.name from DimAttributeOMBusinessUnit b left join dimensionattributelevelvalueallview v on v.dimensionattribute = (select top 1 &hellip; <a href=\"https:\/\/coding.agust.org\/index.php\/2018\/02\/23\/ax-2012-dimension-sql-code-snippet\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AX 2012 dimension sql code snippet&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,2],"tags":[],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-ax2012","category-sql"],"_links":{"self":[{"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":1,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions\/86"}],"wp:attachment":[{"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coding.agust.org\/index.php\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}