<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="https://www.schweda.net/style_feed.css" ?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:atom="http://www.w3.org/2005/Atom"	
	xmlns:dc="http://purl.org/dc/elements/1.1/" > 
<channel>
    <title>schweda.net - Blog</title>
    <link>https://www.schweda.net/</link>
    <description>schweda.net - Blog - Blog-Beitraege</description>
    <language>de-at</language>
    <copyright>Copyright 2006-2026</copyright>
    <generator>schweda.net</generator>
    <managingEditor>heinz.schweda@schweda.net (Heinz Schweda)</managingEditor>
    <webMaster>heinz.schweda@schweda.net (Heinz Schweda)</webMaster>
    <category>Blog</category>
	<atom:link href="https://schweda.net/blog_rss.php?bid=492" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[AX 2012: Erstellen einer DefaultDimension mit mehreren Dimensionen]]></title>
<description><![CDATA[
<p>Nachstehend ein Code-Beispiel, wie man eine RecId vom Typ <strong>DefaultDimension </strong>f&uuml;r mehrere Dimensionen generieren kann.
</p>

<p>Im Beispiel werden die Dimension Kostenstelle mit dem Wert &quot;10&quot;, die Dimension Abteilung mit dem Wert &quot;IT&quot; und die Dimension Kategorie mit dem Wert &quot;02&quot; zu einer DefaultDimension kombiniert.
</p>

<p>Durch den letzten Parameter von <em>findByDimensionAttributeAndValue()</em> wird sichergestellt, da&szlig; fehlende Dimensionen angelegt werden (soferne m&ouml;glich).
</p>

<div class="div_blog_axcode">static void buildDefaultDimension(Args _args)<br />
{<br />
&nbsp;&nbsp;&nbsp; dimensionAttributeValueSetStorage dimensionAttributeValueSetStorage;<br />
&nbsp;&nbsp;&nbsp; dimensionAttribute dimensionAttribute;<br />
&nbsp;&nbsp;&nbsp; dimensionAttributeValue dimensionAttributeValue;<br />
&nbsp;&nbsp;&nbsp; dimensionDefault dimensionDefault;&nbsp;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp; dimensionAttributeValueSetStorage = new DimensionAttributeValueSetStorage();<br />
<br />
&nbsp;&nbsp;&nbsp; // Kostenstelle<br />
&nbsp;&nbsp;&nbsp; dimensionAttribute = dimensionAttribute::findByName('Kostenstelle');<br />
&nbsp;&nbsp;&nbsp; if(dimensionAttribute)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, '10', false, true);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp; // Abteilung<br />
&nbsp;&nbsp;&nbsp; dimensionAttribute = dimensionAttribute::findByName('Abteilung');<br />
&nbsp;&nbsp;&nbsp; if(dimensionAttribute)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, 'IT', false, true);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp; // Kategorie<br />
&nbsp;&nbsp;&nbsp; dimensionAttribute = dimensionAttribute::findByName('Kategorie');<br />
&nbsp;&nbsp;&nbsp; if(dimensionAttribute)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, '02', false, true);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp; dimensionDefault = dimensionAttributeValueSetStorage.save();<br />
<br />
&nbsp;&nbsp;&nbsp; info(strFmt(&quot;Default dimension recId: %1&quot;, dimensionDefault));<br />
}&nbsp;<br />
&nbsp;
</div>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Sun, 10 Nov 2013 17:20:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=492</link>
<comments>https://www.schweda.net/blog_ax.php?bid=492</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=492</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=492</wfw:commentRss>
</item>
</channel>
</rss>	
