<?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=501" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[AX 2012: Finanzdimension als Display-Methode anzeigen]]></title>
<description><![CDATA[
<p>Folgende Display-Methode in der Datasource einer Form zeigt beispielsweise die Finanzdimension <em>Costcenter </em>eines Debitoren an.
</p>


<pre class="pre_blog_axcode">
public display DimensionValue showCostCenter(CustTable _custTable)
{
    DimensionAttributeValueSet dimensionAttributeValueSet;
    DimensionAttributeValueSetItem dimensionAttributeValueSetItem;
    DimensionAttributeValue dimensionAttributeValue;
    DimensionAttribute dimensionAttribute;

    #define.CostCenterDimensionName(&quot;CostCenter&quot;);
 
    if( !_custTable || !_custTable.DefaultDimension)
    {
        return &#39;&#39;;
    } 

    dimensionAttributeValueSet = DimensionAttributeValueSet::find(_custTable.DefaultDimension); 

    select firstOnly RecId
    from dimensionAttributeValueSetItem
        where dimensionAttributeValueSetItem.DimensionAttributeValueSet == dimensionAttributeValueSet.RecId
    join DimensionAttributeValue
        where DimensionAttributeValue.RecId == dimensionAttributeValueSetItem.DimensionAttributeValue
    join RecId from dimensionAttribute
    where dimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute
       &amp;&amp; dimensionAttribute.Name  == #CostCenterDimensionName
    

    if(dimensionAttributeValue &amp;&amp; dimensionAttribute)
    {
        return dimensionAttributeValue.getValue();
    }

    return &#39;&#39;;
}

</pre>


<p><strong>Einfachere Variante (siehe Kommentare)</strong>
</p>


<pre class="pre_blog_axcode">
public display DimensionValue showCostCenter(CustTable _custTable)
{
    #define.CostCenterDimensionName(&quot;CostCenter&quot;);
 
    return ((select firstOnly DisplayValue from DefaultDimensionView
             where DefaultDimensionView.Name == #CostCenterDimensionName
                &amp;&amp; DefaultDimensionView.DefaultDimension == _custTable.DefaultDimension).DisplayValue);
}

</pre>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Thu, 13 Feb 2014 21:40:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=501</link>
<comments>https://www.schweda.net/blog_ax.php?bid=501</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=501</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=501</wfw:commentRss>
</item>
<item>
<title>Kommentar von Rene Sparfeld</title>
<description><![CDATA[Ist es nicht einfacher die View DefaultDimensionView zu nutzen?

return ((select firstOnly DisplayValue from DefaultDimensionView
        where DefaultDimensionView.Name == #CostCenterDimensionName
           && DefaultDimensionView.DefaultDimension == _custTable.DefaultDimension).DisplayValue]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Fri, 14 Feb 2014 12:50:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=501</link>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=501</guid>
<author>Rene Sparfeld</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=501</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Danke Rene für Deinen Hinweis. Dein Code ist einfacher, da hast du vollkommen recht!

Also, wer es kompliziert mag der kann meinen Code verwenden, die elegantere Variante steht im Kommentar von Rene Sparfeld.]]></description>
<category></category>
<pubDate>Fri, 14 Feb 2014 17:32:00 +0100</pubDate>
<link>https://www.schweda.net/blog.php?bid=501</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=501</guid>
<author>Heinz Schweda</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=501</wfw:commentRss>
</item>
</channel>
</rss>	
