<?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=481" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[AX 2012: Subselects über Computed columns abbilden]]></title>
<description><![CDATA[
<p>Mit Hilfe von <strong>Computed columns</strong> von Views sind auch in Dynamics AX <strong>Subselects/Subqueries</strong> m&ouml;glich.
</p>


<p>Im folgenden habe ich eine Methode erstellt, die der Methode <em>inventTable.productName()</em> nachempfunden ist.
</p>


<pre class="pre_blog_axcode">
private static server str compColItemName()
{
    #define.ViewName(&quot;ItemNameView&quot;)

    #define.DataSourceName(&quot;InventTable&quot;)
    #define.FieldItemId(&quot;itemId&quot;)
    #define.FieldProduct(&quot;Product&quot;)
    str sProduct;
    DictView dictView;
    str translationSQLStr;
    str productSQLStr;

    dictView = new DictView(tableNum(#ViewName));

    sProduct = dictView.computedColumnString
        (#DataSourceName,
        #FieldProduct,
        FieldNameGenerationMode::FieldList,
        true);

    translationSQLStr = strFmt(&quot;SELECT Name FROM EcoResProductTranslation WHERE EcoResProductTranslation.Product = %1 AND LanguageId = &#39;%2&#39;&quot;, sProduct, CompanyInfo::find().LanguageId);
    productSQLStr = strFmt(&quot;SELECT DisplayProductNumber FROM EcoResProduct WHERE EcoResProduct.RecId = %1&quot;, sProduct);

    return strFmt(&quot;isNUll((%1), (%2))&quot;, translationSQLStr, productSQLStr);
}
</pre>



<br /><a class="div_blog_category_gotodetail" href="https://www.schweda.net/blog_ax.php?bid=481" target="_self" title="Weiterlesen...">Weiterlesen...</a>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Sat, 30 Nov 2013 11:48:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=481</link>
<comments>https://www.schweda.net/blog_ax.php?bid=481</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=481</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Peter</title>
<description><![CDATA[Ich habe ein Problem mit der View. Wenn in diesem Beispiel der Produktname geändert wird, dann zeigt die View weiterhin den alten Produktnamen an.
Wie kann ich die View dazu bewegen, die Daten neu zu ermitteln?]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Fri, 26 Sep 2014 14:26:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=481</guid>
<author>Peter</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Hallo, normalerweise sollten die Daten sofort aktuell sein. 

Mir fallen auf Anhieb nur zwei mögliche Fehlerquellen ein:
1) Der Name des Produktes wird in meinem Beispiel fix in der Sprache des Unternehmens ausgeben. Kann es sein, daß dein Produktname in einer anderen Sprache geändert wurde?
2) Eine Stolperfalle kann auch sein, daß die Länge des Computed fields im View - welches auf die Methode zeigt - zu kurz ist (man muss hier ggf. die Länge an die Ausgabe der Methode anpassen).]]></description>
<category></category>
<pubDate>Wed, 01 Oct 2014 09:50:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Peter</title>
<description><![CDATA[Danke für die Auflistung.
Es war Fehlerquelle 2).
Mein Fehler.]]></description>
<category></category>
<pubDate>Wed, 01 Oct 2014 10:17:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</guid>
<author>Peter</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Jos Litjens</title>
<description><![CDATA[Thank you very much for this code! Upon implementation however I noticed it wasn\'t complete. InventTable.productname() at one point calls EcoResProductTranslation::findByProductOrSystemLanguage(). That method searches for a translation in the companyInfo language, but when that translation isn\'t found it also searches for a translation in the system language. That last piece was missing from the snippt. i added it and the method now looks like this:

private static server str compColItemName()
{
    #define.ViewName(\"AXTdps_ProdRouteDimReqTransView\")

    #define.DataSourceName(\"InventTable\")
    #define.FieldItemId(\"ItemId\")
    #define.FieldProduct(\"Product\")
    str sProduct;
    DictView    dictView;
    str         ret;
    str         translationSQLStrCompLang, translationSQLStrSysLang;
    str         productSQLStr;

    dictView = new DictView(tableNum(#ViewName));

    sProduct = dictView.computedColumnString
        (#DataSourceName,
        #FieldProduct,
        FieldNameGenerationMode::FieldList,
        true);

    translationSQLStrCompLang = strFmt(\"SELECT Name FROM EcoResProductTranslation WHERE EcoResProductTranslation.Product = %1 AND LanguageId = \'%2\'\", sProduct, CompanyInfo::find().LanguageId);
    translationSQLStrSysLang = strFmt(\"SELECT Name FROM EcoResProductTranslation WHERE EcoResProductTranslation.Product = %1 AND LanguageId = \'%2\'\", sProduct, SystemParameters::getSystemLanguageId());    
    productSQLStr = strFmt(\"SELECT DisplayProductNumber FROM EcoResProduct WHERE EcoResProduct.RecId = %1\", sProduct);

    ret =  strFmt(\"isNUll((%1), (%2))\", translationSQLStrCompLang, translationSQLStrSysLang);
    ret =  strFmt(\"isNUll((%1), (%2))\", ret, productSQLStr);
    return ret;
}]]></description>
<category></category>
<pubDate>Wed, 19 Nov 2014 10:17:00 +0100</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</guid>
<author>Jos Litjens</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Thank you very much for your extension. 

So everybody, who is looking for a replacement for the itemName()-method, should use the code of Jos.]]></description>
<category></category>
<pubDate>Wed, 26 Nov 2014 09:53:00 +0100</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Jon</title>
<description><![CDATA[Can this be added to PurchLineOpenOrder form? How would you set up the joinsource on the view once added to the above form?]]></description>
<category></category>
<pubDate>Wed, 10 Jun 2015 21:11:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</guid>
<author>Jon</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Yes, you can use the abobe view in form PurchLineOpenOrder.

You have to do the following steps:
1) Add view as new dataSource to form
2) Set properties of this new datasource:
   JoinSource: PurchLine
   LinkType: InnerJoin
3) Overwrite the init()-Method of the new datasource like the following

public void init()
{
    super();

    this.query().dataSourceName(this.name()).clearLinks();
    this.query().dataSourceName(this.name()).clearDynalinks();

    this.query().dataSourceName(this.name()).addlink(fieldNum(PurchLine, ItemId), fieldnum(ItemNameView, ItemId));
}

Please note, that there are additional steps needed, depending on your form. Especially if your form is not a \"read-only\" form like PurchLineOpenOrder is.]]></description>
<category></category>
<pubDate>Tue, 16 Jun 2015 10:43:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Max</title>
<description><![CDATA[Hallo, 
toller Post.

Ist es z.B. möglich alle Sprachen für diesen Artikel in einem Feld aufgelistet zu bekommen? Mit while select oder Next?

Danke

Max]]></description>
<category></category>
<pubDate>Tue, 15 Sep 2015 18:12:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</guid>
<author>Max</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Hallo Max, auf Basis deiner Frage habe ich einen neuen Beitrag geschrieben, wo ich demonstriere wie man beispielsweise Daten aus mehreren Datensätzen zu einem einzigen Feld kombinieren kann. 

Du findest den Eintrag hier: http://www.schweda.net/blog_ax.php?bid=585

Ich hoffe, daß der deine Frage beantwortet, wenn nicht einfach kommentieren.]]></description>
<category></category>
<pubDate>Sat, 19 Sep 2015 10:16:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</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=481</wfw:commentRss>
</item>
<item>
<title>Kommentar von Rene Fauland</title>
<description><![CDATA[I think the computed column gets only executed once (during synchronization) - just check the generated view direct in SQL.
In this case the language info from SystemParameters should only work if you have just one single partition and language from CompanyInfo will not work (i assume it uses the company settings from dat or to be more precise, the company it\'s in during synchronization) :-/]]></description>
<category></category>
<pubDate>Tue, 31 May 2016 07:15:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=481</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=481</guid>
<author>Rene Fauland</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=481</wfw:commentRss>
</item>
</channel>
</rss>	
