<?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=608" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[Query nach Finanzdimension sortieren]]></title>
<description><![CDATA[
<p>Um in einem Query nach einer Finanzdimension sortieren zu k&ouml;nnen, ist die Methode <em>SysQuery::addOrderByDimensionAttribute()</em> zu verwenden.
</p>


<p>Das folgende Beispiel soll dies veranschaulichen. In diesem Job werden alle Debitoren ausgegeben und dabei nach der Dimension <em>CostCenter </em>sortiert.
</p>


<pre class="pre_blog_axcode">
static void sortByDimension(Args _args)
{
    Query query;
    QueryRun queryRun;
    QueryBuildDataSource qbds;
    CustTable custTable;
    DimensionComponent dimensionComponent;
    DimensionValue dimensionValue;

    #define.CostCenterDimensionName(&quot;CostCenter&quot;);

    query = new Query();
    qbds = query.addDataSource(tableNum(CustTable));

    SysQuery::addOrderByDimensionAttribute(query,
                                           qbds.name(),
                                           fieldId2name(tableNum(CustTable),
                                                        fieldNum(CustTable, DefaultDimension)),
                                           DimensionComponent::DimensionAttribute,
                                           SortOrder::Ascending,
                                           #CostCenterDimensionName);

    queryRun = new QueryRun(query);
    while(queryRun.next())
    {
        custTable = queryRun.get(tableNum(CustTable));

        // Get dimension value
        dimensionValue =
        (select firstonly DisplayValue from defaultDimensionView
         where defaultDimensionView.Name == #CostCenterDimensionName
            &amp;&amp; defaultDimensionView.DefaultDimension == custTable.DefaultDimension).DisplayValue;

        info(strFmt(&quot;%1 %2&quot;, custTable.AccountNum, dimensionValue));
    }
}
</pre>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Sat, 08 Oct 2016 17:51:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=608</link>
<comments>https://www.schweda.net/blog_ax.php?bid=608</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=608</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=608</wfw:commentRss>
</item>
</channel>
</rss>	
