<?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 posts</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://www.schweda.net/blog_rss.php?bid=585" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[Daten aus mehreren Datensätzen zu einem Feld zusammenführen mit Hilfe von Computed Columns]]></title>
<description><![CDATA[
<p><strong>Computed Columns</strong> von Views sind ein recht m&auml;chtiges Werzeug, wenn es darum geht komplexe SQL-Abfragen auch in Dynamics AX abzubilden.<br />
<br />
<img alt="Screenshot" height="172" src="http://www.schweda.net/pictures/blogpics/ax2012_compcol_multiple_line_one_field_1.jpg" style="float:right" title="Screenshot" width="272" />Das folgende Beispiel zeigt, wie es m&ouml;glich ist mehrere Zeilen zu einem einzigen Feld zusammenzuf&uuml;hren.<br />
Stellt euch vor, ihr m&ouml;chtet eine Abfrage zur Verf&uuml;gung stellen, wo alle Artikel/Freigegebenen Produkte aufgelistet werden (eine Zeile je Artikel) und es ein Feld gibt, in dem der Produktname in allen hinterlegten Sprachen ausgegeben wird.<br />
<br />
F&uuml;r diese Anforderung kann man folgende Methode <em>compColLanguageNames</em> verwenden, die ich in einen View <em>ItemNameView </em>als Computed Column namens <em>AllItemNames </em>eingebunden habe.
</p>


<pre class="pre_blog_axcode">
private static server str compColLanguageNames()
{
    #define.ViewName(&quot;ItemNameView&quot;)
    #define.DataSourceName(&quot;InventTable&quot;)
    #define.FieldProduct(&quot;Product&quot;)
    DictView dictView;
    str sProduct;
    str translationSQLStr;

    dictView = new DictView(tableNum(#ViewName));

    sProduct = dictView.computedColumnString
         (#DataSourceName,
         #FieldProduct,
         FieldNameGenerationMode::FieldList,
         true);

    translationSQLStr = strFmt(@&quot;SELECT Name + &#39; &#39; AS &#39;data()&#39; FROM EcoResProductTranslation WHERE EcoResProductTranslation.Product = %1 FOR XML PATH(&#39;&#39;)&quot;, sProduct);

    return strFmt(&quot;isNUll((%1), (&#39;&#39;))&quot;, translationSQLStr);
}
</pre>


<p>Das Ergebnis sieht im Tablebrowser wie folgt aus:
</p>


<p><a href="http://www.schweda.net/pictures/blogpics/ax2012_compcol_multiple_line_one_field_2.jpg" target="_blank"><img alt="Screenshot" height="176" src="http://www.schweda.net/pictures/blogpics/tb_ax2012_compcol_multiple_line_one_field_2.jpg" title="Screenshot" width="465" /></a>
</p>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Sat, 19 Sep 2015 10:11:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=585</link>
<comments>https://www.schweda.net/blog_ax.php?bid=585</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=585</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=585</wfw:commentRss>
</item>
</channel>
</rss>	
