<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Doens.be &#187; X++</title>
	<atom:link href="http://www.doens.be/tag/x/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.doens.be</link>
	<description></description>
	<lastBuildDate>Sat, 07 Jan 2012 04:20:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Change the language at runtime</title>
		<link>http://www.doens.be/2011/11/change-the-language-at-runtime/</link>
		<comments>http://www.doens.be/2011/11/change-the-language-at-runtime/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 06:00:18 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 4.0]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Ax 6.0 (2012)]]></category>
		<category><![CDATA[Infolog]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=979</guid>
		<description><![CDATA[Normally when you change your language you go to your user options, change your current language and the restart the client. This week I got the question if it was possible to do so in runtime. You can do so by just calling the infolog.language(str 7 _languageCode). All labels that you load after calling this [...]]]></description>
			<content:encoded><![CDATA[<p>Normally when you change your language you go to your user options, change your current language and the restart the client. This week I got the question if it was possible to do so in runtime. You can do so by just calling the <strong>infolog.language(<span style="color: #000080;">str</span> <span style="color: #ff0000;">7</span> _languageCode)</strong>. All labels that you load after calling this method will be translated to the new language.<span id="more-979"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> JDO_ChangeLanguage<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
    infolog.<span style="color: #000000;">language</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'nl-be'</span><span style="color: #000000;">&#41;</span>; <span style="color: #007f00;">// Change the language to nl-be</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
    infolog.<span style="color: #000000;">language</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'fr-be'</span><span style="color: #000000;">&#41;</span>; <span style="color: #007f00;">// Change the language to fr-be</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
    infolog.<span style="color: #000000;">language</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'it'</span><span style="color: #000000;">&#41;</span>; <span style="color: #007f00;">// Change the language to it</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
    infolog.<span style="color: #000000;">language</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'de'</span><span style="color: #000000;">&#41;</span>; <span style="color: #007f00;">// Change the language to de</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
    infolog.<span style="color: #000000;">language</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'en-us'</span><span style="color: #000000;">&#41;</span>; <span style="color: #007f00;">// Change the language to en-us</span>
    info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS1&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>And the result is:</p>
<p><img class="size-full wp-image-980 alignnone" title="infologLanguage" src="http://www.doens.be/wp-content/uploads/2011/11/infologLanguage.png" alt="" width="356" height="390" /></p>
<p><strong>Caution</strong>: When you use this function make sure you get the current language before you use this function, so you can change it back when you don&#8217;t need it any more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2011/11/change-the-language-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amount in words</title>
		<link>http://www.doens.be/2011/11/amount-in-words/</link>
		<comments>http://www.doens.be/2011/11/amount-in-words/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 06:00:42 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 4.0]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Ax 6.0 (2012)]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=971</guid>
		<description><![CDATA[This week one of my customers asked me to place the amount in words on a invoice. I couldn&#8217;t believe that sush function wasn&#8217;t availible in standard Ax. After some research I found that the Global-class contains the following methods: static TempStr numeralsToTxt(real _num) static TempStr numeralsToTxt_EN(real _num) static TempStr numeralsToTxt_ES(real _num) static TempStr numeralsToTxt_FR(real [...]]]></description>
			<content:encoded><![CDATA[<p>This week one of my customers asked me to place the amount in words on a invoice. I couldn&#8217;t believe that sush function wasn&#8217;t availible in standard Ax. After some research I found that the <strong>Global-class</strong> contains the following methods:</p>
<ul>
<li><span style="color: #000080;">static TempStr</span> <strong>numeralsToTxt</strong>(<span style="color: #000080;">real</span> _num)</li>
<li><span style="color: #000080;">static TempStr</span> <strong>numeralsToTxt_EN</strong>(<span style="color: #000080;">real</span> _num)</li>
<li><span style="color: #000080;">static TempStr</span> <strong>numeralsToTxt_ES</strong>(<span style="color: #000080;">real</span> _num)</li>
<li><span style="color: #000080;">static TempStr</span> <strong>numeralsToTxt_FR</strong>(<span style="color: #000080;">real</span> _num)</li>
<li><span style="color: #000080;">static TempStr</span> <strong>numeralsToTxt_NL</strong>(<span style="color: #000080;">real</span> _num)</li>
</ul>
<p><span id="more-971"></span>So you can just use these methods like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> JDO_AmountInWords<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    info<span style="color: #000000;">&#40;</span>numeralsToTxt<span style="color: #000000;">&#40;</span><span style="color: #000000;">123456789.12</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And you get the following result:</p>
<p><img class="size-full wp-image-973 alignnone" title="numeralsToTxt" src="http://www.doens.be/wp-content/uploads/2011/11/numeralsToTxt.png" alt="" width="356" height="323" /></p>
<p>I know these methods aren&#8217;t perfect, but they can be a start and save you a lot of programming time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2011/11/amount-in-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Index vs Index hint</title>
		<link>http://www.doens.be/2010/10/index-vs-index-hint/</link>
		<comments>http://www.doens.be/2010/10/index-vs-index-hint/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 05:00:34 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=757</guid>
		<description><![CDATA[This is a discussion I had with several colleagues. What is the difference between index and index hint and what do we use in our code? There are a lot of misunderstandings about what these keywords actually  do. When you use the index keyword in a select statement the kernel will translate this to a [...]]]></description>
			<content:encoded><![CDATA[<p>This is a discussion I had with several colleagues. What is the difference between <strong>index</strong> and <strong>index hint</strong> and what do we use in our code?</p>
<p><span id="more-757"></span>There are a lot of misunderstandings about what these keywords actually  do. When you use the <strong>index</strong> keyword in a select statement the kernel will translate this to a <strong>order by</strong> command and the database optimizer will chose the best index to actually use. When you chose to use the<strong> index hint</strong> keyword in your select statement, Ax will <strong>force</strong> the database to use the chosen <strong>index</strong>.</p>
<p>Now what guideline should you use in writing your select statement? Index / Index hint or should you write nothing and let Ax decide what to do with the query. There are pro&#8217;s and con&#8217;s for all decisions.<br />
Some people have no trust in the common sense of the developer and say <em>&#8216;let the database optimizer chose&#8217;</em>, it will know what&#8217;s best.<br />
Personally I&#8217;m a big fan of using the index keyword in all your select statement because you it forces you to think about the indexes that are available on the table or if you should add a extra index to optimize the database-call for your SQL statement. In the end, the database optimizer can chose what the best index is to use.</p>
<p>If anyone has a opinion about this matter, don&#8217;t hesitate to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/10/index-vs-index-hint/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Testing code on client/server</title>
		<link>http://www.doens.be/2010/09/testing-code-on-clientserver/</link>
		<comments>http://www.doens.be/2010/09/testing-code-on-clientserver/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 05:00:07 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=711</guid>
		<description><![CDATA[When you quickly want to test some code I often write some test-code in a small job. When you execute the code in this job, it will be executed on client-side. A colleague of mine asked me if he could test the same job while running on server-side. Wen you quickly want to test the [...]]]></description>
			<content:encoded><![CDATA[<p>When you quickly want to test some code I often write some test-code in a small job. When you execute the code in this job, it will be executed on client-side. A colleague of mine asked me if he could test the same job while running on server-side.</p>
<p>Wen you quickly want to test the same code when it is running on server side, you can simply create a <strong>action-menu item</strong> from this job and change the property &#8216;<strong>RunOn</strong>&#8216; property to &#8216;<strong>Server</strong>&#8216;. Now when you execute the menu item, the job will be executed on server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/09/testing-code-on-clientserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loop all tables</title>
		<link>http://www.doens.be/2010/09/loop-all-tables/</link>
		<comments>http://www.doens.be/2010/09/loop-all-tables/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 05:00:18 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Dictionary]]></category>
		<category><![CDATA[DictTable]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=700</guid>
		<description><![CDATA[There is a simple trick to loop all tables that are available in Ax. Just use the Dictionary-class that contains all information about tables. Small example to list all tablenames + their corresponding Id. 1 2 3 4 5 6 7 8 9 10 static void JeDoe_listTables&#40;Args _args&#41; &#123; Dictionary dictionary = new Dictionary&#40;&#41;; int [...]]]></description>
			<content:encoded><![CDATA[<p>There is a simple trick to loop all tables that are available in Ax. Just use the Dictionary-class that contains all information about tables.</p>
<p>Small example to list all tablenames + their corresponding Id.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> JeDoe_listTables<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    Dictionary  dictionary <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> Dictionary<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">int</span>         i;
    ;
    <span style="color: #0000ff;">for</span> <span style="color: #000000;">&#40;</span>i<span style="color: #00007f;">=</span><span style="color: #000000;">1</span> ; i<span style="color: #00007f;">&lt;=</span>dictionary.<span style="color: #000000;">tableCnt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> ; i<span style="color: #00007f;">++</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        info<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strfmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'%1;%2'</span><span style="color: #00007f;">,</span> dictionary.<span style="color: #000000;">tableCnt2Id</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span> <span style="color: #0000ff;">tableid2name</span><span style="color: #000000;">&#40;</span> dictionary.<span style="color: #000000;">tableCnt2Id</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>When you combine this with a DictTable / DictField-object, there are lots of possibilities.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/09/loop-all-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Records with RecId 101090</title>
		<link>http://www.doens.be/2010/08/records-with-recid-101090/</link>
		<comments>http://www.doens.be/2010/08/records-with-recid-101090/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 05:00:37 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 4.0]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=643</guid>
		<description><![CDATA[I was using the postload method of the HRMBenefitType-table to fill the description-field with language-sensitive description (from LanguageTxt). This works fine when I view the record, but not when I use a lookup. I&#8217;ve put a break-point on my postload method and noticed the recId (this.recid of the HRMBenefitType table). This is always the 101090. [...]]]></description>
			<content:encoded><![CDATA[<p>I was using the postload method of the HRMBenefitType-table to fill the description-field with language-sensitive description (from LanguageTxt). This works fine when I view the record, but not when I use a lookup.</p>
<p>I&#8217;ve put a break-point on my postload method and noticed the <strong>recId</strong> (this.recid of the HRMBenefitType table). This is always the <strong>101090</strong>. When I check this in the tablebrowser, this does not match the actual RecId valule.<br />
I checked the SQL-trace-log and noticed the following instruction:</p>
<blockquote><p>SELECT A.HRMBENEFITTYPEID,A.DESCRIPTION,A.RECVERSION,101090 FROM HRMBENEFITTYPE A WHERE (DATAAREAID=?) ORDER BY A.DATAAREAID,A.HRMBENEFITTYPEID OPTION(FAST 1)</p></blockquote>
<p><strong>The solution</strong> to this problem is simple. Just change the <strong>CacheLookup</strong> property to <strong>EntireTable</strong> and the strange behaviour of the RecId-field stops.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/08/records-with-recid-101090/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dialog Extended</title>
		<link>http://www.doens.be/2010/05/dialog-extended/</link>
		<comments>http://www.doens.be/2010/05/dialog-extended/#comments</comments>
		<pubDate>Wed, 12 May 2010 05:00:33 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=570</guid>
		<description><![CDATA[One of my colleagues (Koen Dedecker) was looking for a way to prevent user interaction with other forms while a certain dialog is shown. After some research he found the solution on the blog Dynamics AX tools and tutorials from Vanya Kashperuk. A few years ago (2007) he made a simple extension of the dialog class [...]]]></description>
			<content:encoded><![CDATA[<p>One of my colleagues (Koen Dedecker) was looking for a way to <strong>prevent user interaction with other forms while a certain dialog is shown</strong>. After some research he found the solution on the blog <a href="http://kashperuk.blogspot.com">Dynamics AX tools and tutorial</a>s from Vanya Kashperuk. A few years ago (2007) he made a simple extension of the dialog class that makes this possible. You can find more information and download some code samples on <a href="http://kashperuk.blogspot.com/2007/06/3-dialog-extensions.html">http://kashperuk.blogspot.com/2007/06/3-dialog-extensions.html</a>.</p>
<p>The trick is actually simple:</p>
<ul>
<li>Create a new variable of the type Boolean en the classDeclaration of the Dialog-class</li>
<li>Create a public parm method for this new variable to get/set the value</li>
<li>Extend the wait-method by placing the following code before the close-statement:

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;">dialogform.<span style="color: #000000;">formRun</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">wait</span><span style="color: #000000;">&#40;</span>this.<span style="color: #000000;">parmShowModal</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

</li>
</ul>
<p>Now when you make a new instance of the dialog class just set the value of the <strong>parmShowModal()</strong> to true. From now on this dialog will stay on top.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/05/dialog-extended/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few things you should know about temporary tables</title>
		<link>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/</link>
		<comments>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/#comments</comments>
		<pubDate>Mon, 10 May 2010 05:00:43 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[DictTable]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=530</guid>
		<description><![CDATA[How do you set a table temporary: You can set the property &#8216;temporary&#8217; in the AOT to yes &#8211;&#62; this table is always temporary You can declare a buffer of a table and call the method setTemp() or setTempData(), from that moment on the buffer contains temporary data. CustTable custTable; ; custTable.setTmp&#40;&#41;; if &#40;custTable.isTmp&#40;&#41;&#41; &#123; [...]]]></description>
			<content:encoded><![CDATA[<div>How do you set a table temporary:</div>
<div>
<ul>
<li>You can set the property &#8216;temporary&#8217; in the AOT to yes &#8211;&gt; this table is always temporary<br />
<a href="http://www.doens.be/wp-content/uploads/2010/05/temporaryTable.png"><img class="alignnone size-full wp-image-532" title="temporaryTable" src="http://www.doens.be/wp-content/uploads/2010/05/temporaryTable.png" alt="" width="292" height="248" /></a></li>
<li>You can declare a buffer of a table and call the method <a href="http://msdn.microsoft.com/en-us/library/aa882578.aspx">setTemp()</a> or <a href="http://msdn.microsoft.com/en-US/library/aa856495(v=AX.50).aspx">setTempData()</a>, from that moment on the buffer contains temporary data.

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;">CustTable custTable;
;
custTable.<span style="color: #000000;">setTmp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>custTable.<span style="color: #000000;">isTmp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #007f00;">// Do something with your temporary table</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

</li>
</ul>
</div>
<div>Things to know:</div>
<ul>
<li>When you declare a buffer of a record of temporary table type, the table does not contain any values.</li>
<li>Memmory and filespace aren&#8217;t allocated for a temporary table till the first record is inserted. This means that you have to watch out for client/server problems.<br />
When the first record is inserted in a buffer on the client tier, the memory is allocated there. All actions (insert / update / delete) to this buffer will run trough that tier, so try to reduce round-trips and improve your performance.</li>
<li>When you declare 2 different buffers of the same temporary table, they will both have a life of their own. To share the date between the tables use the setTmpData method.<br />
for example: tmpCommonBuffer1.setTmpData(tmpCommonBuffer2);</li>
<li>You can&#8217;t (normally) set up logging on temporary tables.</li>
<li>Use the method isTmp() to know if a record is temporary or not (true &#8211;&gt; temporary, false &#8211;&gt; phisical)</li>
</ul>
<p><strong>My opinion:</strong> Temporary tables are very useful and can help you to easily manipulate data you don&#8217;t need store permanently, but watch out where and how you use them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Ax Infolog</title>
		<link>http://www.doens.be/2010/05/the-ax-infolog/</link>
		<comments>http://www.doens.be/2010/05/the-ax-infolog/#comments</comments>
		<pubDate>Fri, 07 May 2010 05:00:25 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Best Practice]]></category>
		<category><![CDATA[Infolog]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[User interaction]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=535</guid>
		<description><![CDATA[Wel all know the small dialog that gives the user usefull information about what is happening in Ax. In this post I will tell u some more about this. You can add information to the Infolog by calling: Infolog.add(&#8230;) info(&#8230;) warning(&#8230;) or checkfailed(&#8230;) error(&#8230;) You can add some structure in it by using setPrefix(&#8230;) Using [...]]]></description>
			<content:encoded><![CDATA[<p>Wel all know the small dialog that gives the user usefull information about what is happening in Ax. In this post I will tell u some more about this.</p>
<p>You can add information to the Infolog by calling:</p>
<ul>
<li>Infolog.add(&#8230;)</li>
<li><a href="http://www.doens.be/wp-content/uploads/2010/05/icon_info.gif"><img class="alignnone size-full wp-image-536" title="icon_info" src="http://www.doens.be/wp-content/uploads/2010/05/icon_info.gif" alt="" width="17" height="14" /></a> info(&#8230;)</li>
<li><a href="http://www.doens.be/wp-content/uploads/2010/05/icon_warning.gif"><img class="alignnone size-full wp-image-537" title="icon_warning" src="http://www.doens.be/wp-content/uploads/2010/05/icon_warning.gif" alt="" width="17" height="16" /></a> warning(&#8230;) or checkfailed(&#8230;)</li>
<li><a href="http://www.doens.be/wp-content/uploads/2010/05/icon_error.gif"><img class="alignnone size-full wp-image-538" title="icon_error" src="http://www.doens.be/wp-content/uploads/2010/05/icon_error.gif" alt="" width="15" height="14" /></a> error(&#8230;)</li>
<li>You can add some structure in it by using setPrefix(&#8230;)</li>
<li>Using the Proxy-class for the Enterprise Portal</li>
</ul>
<p><a href="http://www.doens.be/wp-content/uploads/2010/05/infolog_FirstExample.png"><img class="alignnone size-full wp-image-545" title="infolog_FirstExample" src="http://www.doens.be/wp-content/uploads/2010/05/infolog_FirstExample.png" alt="" width="348" height="344" /></a><br />
<span id="more-535"></span><br/><br />
The <strong>info</strong>(), <strong>warning</strong>() and <strong>error</strong>() method are found in the Global class and can contain up to 3 arguments:</p>
<ul>
<li>a string <em>(mandatory) </em>: the string that is added to the infolog</li>
<li>a path to the Axapta Help <em>(optional)</em></li>
<li>an Infolog action <em>(optional)</em> : you can use this parameter to initiate a action, for example open the code editor or open a parameter-form when some parameters are missing. Depending on what action you want to trigger, you need to call the right method that extend from sysInfoAction.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">SysInfoAction   sysInfoAction;
;
sysInfoAction <span style="color: #00007f;">=</span> SysInfoAction_Formrun<span style="color: #00007f;">::</span><span style="color: #000000;">newFormname</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">formstr</span><span style="color: #000000;">&#40;</span>HRMParameters<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
info<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;click on me&quot;</span><span style="color: #00007f;">,</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00007f;">,</span> sysInfoAction<span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p><a href="http://www.doens.be/wp-content/uploads/2010/05/infolog_clickOnme.png"><img class="alignnone size-full wp-image-546" title="infolog_clickOnme" src="http://www.doens.be/wp-content/uploads/2010/05/infolog_clickOnme.png" alt="" width="348" height="344" /></a><br />
<br/><br />
Using the keyword <strong>Throw </strong>before info(), error() or warning will result in terminating the execution (or jump to catch statement) and a rollback of your transactions.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">throw</span> error<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Something bad happend&quot;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p><a href="http://www.doens.be/wp-content/uploads/2010/05/infolog_throwerror1.png"><img class="alignnone size-full wp-image-554" title="infolog_throwerror" src="http://www.doens.be/wp-content/uploads/2010/05/infolog_throwerror1.png" alt="" width="348" height="323" /></a><br />
<br/><br />
The method <strong>setPrefix</strong>() will help you to group info(), warning() and error() messages with a header. using setPrefix() will make a indentation for your current block of code <em>(everything between { and }).</em> Leaving the code-block will automatically result in going one indentation back.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">int</span> i;
<span style="color: #0000ff;">int</span> j;
;
<span style="color: #0000ff;">setPrefix</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Testing out setPrefix&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">for</span> <span style="color: #000000;">&#40;</span>i<span style="color: #00007f;">=</span><span style="color: #000000;">1</span> ; i<span style="color: #00007f;">&amp;</span>lt;<span style="color: #00007f;">=</span><span style="color: #000000;">2</span> ; i<span style="color: #00007f;">++</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0000ff;">setPrefix</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strfmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Prefix %1&quot;</span><span style="color: #00007f;">,</span> i<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #0000ff;">for</span> <span style="color: #000000;">&#40;</span>j<span style="color: #00007f;">=</span><span style="color: #000000;">1</span> ; j<span style="color: #00007f;">&amp;</span>lt;<span style="color: #00007f;">=</span><span style="color: #000000;">3</span> ; j<span style="color: #00007f;">++</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		info<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strfmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Info %1&quot;</span><span style="color: #00007f;">,</span> j<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p><a href="http://www.doens.be/wp-content/uploads/2010/05/infolog_setPrefic.png"><img class="alignnone size-full wp-image-547" title="infolog_setPrefic" src="http://www.doens.be/wp-content/uploads/2010/05/infolog_setPrefic.png" alt="" width="348" height="403" /></a><br />
<br/><br />
The <strong>checkFailed</strong>() method is a warning() method that returns a Boolean (alwais false). U can use this method when you want to display a warning and directly set a return value to false.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">Boolean</span> ret;
;
<span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ret <span style="color: #00007f;">=</span> checkFailed<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Something is wrong&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #0000ff;">return</span> ret;</pre></td></tr></table></div>

<p><a href="http://www.doens.be/wp-content/uploads/2010/05/infolog_checkFailed.png"><img class="alignnone size-full wp-image-558" title="infolog_checkFailed" src="http://www.doens.be/wp-content/uploads/2010/05/infolog_checkFailed.png" alt="" width="348" height="323" /></a><br />
<br/><br />
<strong>Note:</strong> The infolog can contain <strong>maximum 10000 lines</strong>. So try to limit the use of it. Building the output of the infolog usually happens at the end of the code you are executing and depending on the number of lines, it can take a while. You can limit the maximum number of lines under a header in a batch by setting the property<strong> infolog.errorsPerBatch(#)</strong>(). When this number is exceeded only the furst # will appear and Ax will give you a notification that their could be more errors.<br />
It is also possible to update the infolog while executing code by calling the method<strong> infolog.viewUpdate</strong>().<br />
<br/><br />
<strong>Using the infolog in the Enterprise Portal:</strong><br />
In the portal you can access the infolog by using the Proxy of the Enterprise Portal.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);</pre></td></tr></table></div>

<p>Now, when you want to write something to the infolog you need to give a Enum with it, so the portal knows if the message you want to show is a info, warning or error. So pass through Proxy.Exception.Info, Proxy.Exception.Warning or Proxy.Exception.Error.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">objInfoLog.add(Proxy.Exception.Warning, &quot;My warning&quot;);</pre></td></tr></table></div>

<p><br/><br />
So in short thing you should <strong>keep in mind</strong> while using the Infolog-class:</p>
<ul>
<li>Use short &#038; informative messages</li>
<li>Choose the righty message level (info, warning, error)</li>
<li>Use actions, this simple trick is verry usefull for end-users</li>
<li>Limit the number of messages you send to the Infolog-dialog</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/05/the-ax-infolog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Execute a job on data in several companies &#8211; part2</title>
		<link>http://www.doens.be/2010/04/execute-a-job-on-data-in-several-companies-part2/</link>
		<comments>http://www.doens.be/2010/04/execute-a-job-on-data-in-several-companies-part2/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 11:00:14 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=518</guid>
		<description><![CDATA[In one of my previous posts I explained that you can switch company with the keyword changecompany. I also made a remark that you should set the value of your table-value to null after each changecompany. Small code example (bad): 1 2 3 4 5 6 7 8 9 10 11 12 DataArea dataArea; PurchTable [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my previous posts I explained that you can switch company with the keyword <a href="http://www.doens.be/2010/04/execute-a-job-on-data-in-several-companies">changecompany</a>. I also made a remark that you should set the value of your table-value to null after each changecompany.</p>
<p>Small code example (bad):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">DataArea dataArea;
PurchTable purchTable;
;
<span style="color: #0000ff;">while</span> <span style="color: #0000ff;">select</span> dataArea
<span style="color: #0000ff;">where</span> <span style="color: #00007f;">!</span>dataArea.<span style="color: #000000;">isVirtual</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">changecompany</span><span style="color: #000000;">&#40;</span>dataArea.<span style="color: #000000;">id</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0000ff;">select</span> <span style="color: #0000ff;">firstonly</span> purchTable;
        info<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strfmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;%1 (%2)&quot;</span><span style="color: #00007f;">,</span> purchTable.<span style="color: #000000;">purchId</span><span style="color: #00007f;">,</span> purchTable.<span style="color: #000000;">dataAreaId</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The result is:<br />
<a href="http://www.doens.be/wp-content/uploads/2010/04/changecompany_bad.png"><img class="size-full wp-image-522 alignnone" title="changecompany_bad" src="http://www.doens.be/wp-content/uploads/2010/04/changecompany_bad.png" alt="" width="349" height="441" /></a></p>
<p>You can clearly see that the table variable is is known in the company you declared it.</p>
<p>Small code example (good):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">DataArea dataArea;
PurchTable purchTable;
;
<span style="color: #0000ff;">while</span> <span style="color: #0000ff;">select</span> dataArea
<span style="color: #0000ff;">where</span> <span style="color: #00007f;">!</span>dataArea.<span style="color: #000000;">isVirtual</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">changecompany</span><span style="color: #000000;">&#40;</span>dataArea.<span style="color: #000000;">id</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        purchTable <span style="color: #00007f;">=</span> <span style="color: #0000ff;">null</span>;
        <span style="color: #0000ff;">select</span> <span style="color: #0000ff;">firstonly</span> purchTable;
        info<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strfmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;%1 (%2)&quot;</span><span style="color: #00007f;">,</span> purchTable.<span style="color: #000000;">purchId</span><span style="color: #00007f;">,</span> purchTable.<span style="color: #000000;">dataAreaId</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The result:<br />
<a href="http://www.doens.be/wp-content/uploads/2010/04/changecompany_good.png"><img class="alignnone size-full wp-image-523" title="changecompany_good" src="http://www.doens.be/wp-content/uploads/2010/04/changecompany_good.png" alt="" width="349" height="441" /></a></p>
<p>So by making this small code change it runs perfectly.</p>
<p>NOTE: When you are calling a new method in the changecompany statement, you don&#8217;t have to set all the common variables that you declare  equal to &#8216;null&#8217;. This because they are declared after the companychange.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/04/execute-a-job-on-data-in-several-companies-part2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

