<?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; Class</title>
	<atom:link href="http://www.doens.be/tag/class/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>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>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>Batch job performance boost</title>
		<link>http://www.doens.be/2010/04/batch-job-performance-boost/</link>
		<comments>http://www.doens.be/2010/04/batch-job-performance-boost/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 05:00:16 +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[Class]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RunBaseBatch]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=494</guid>
		<description><![CDATA[Did you ever have trouble with the performance of your batch-job? Well maybe this small trick can shorten the time your batch runs. The big idea: Try to split up your gigantic batch in smaller pieces. Launch a batchjob that produces many smaller batchjobs (tasks) that can handle a subset of the data you need to [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever have trouble with the performance of your batch-job? Well maybe this small trick can shorten the time your batch runs.</p>
<p><strong>The big idea</strong>: Try to split up your gigantic batch in smaller pieces. Launch a batchjob that produces many smaller batchjobs (tasks) that can handle a subset of the data you need to process. For example you can create a batch that creates a batch with sub-tasks for each company.</p>
<p>How do you plan a batch from code?</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;">BatchHeader batHeader;
BatchInfo batInfo;
TstRunBase rbbTask;
;
rbbTask <span style="color: #00007f;">=</span> TstMyBatch<span style="color: #00007f;">::</span><span style="color: #000000;">construct</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
batInfo <span style="color: #00007f;">=</span> rbbTask.<span style="color: #000000;">batchInfo</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
batInfo.<span style="color: #000000;">parmCaption</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;MyBatch&quot;</span><span style="color: #000000;">&#41;</span>;
batInfo.<span style="color: #000000;">parmGroupId</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>;
batHeader <span style="color: #00007f;">=</span> BatchHeader<span style="color: #00007f;">::</span><span style="color: #000000;">construct</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
batHeader.<span style="color: #000000;">addTask</span><span style="color: #000000;">&#40;</span>rbbTask<span style="color: #000000;">&#41;</span>;
batHeader.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
info<span style="color: #000000;">&#40;</span>batInfo.<span style="color: #000000;">parmCaption</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>You can download a quick example I made. This is a job you can schedule and it will produce a new Batch job with a task for each company when you don&#8217;t select a company while shedualing (<a href="http://www.doens.be/wp-content/uploads/2010/04/Class_TstRunBase.xpo" target="_blank">Class_TstRunBase.xpo</a>). I hope this can help you.</p>
<p>Schedule the batch:<a href="http://www.doens.be/wp-content/uploads/2010/04/batchjob_schedule.png"><br />
<img class="size-full wp-image-496 alignnone" title="batchjob_schedule" src="http://www.doens.be/wp-content/uploads/2010/04/batchjob_schedule.png" alt="" width="295" height="160" /></a></p>
<p>The result:<br />
<a href="http://www.doens.be/wp-content/uploads/2010/04/batchjob_overview.png"><img class="alignnone size-full wp-image-497" title="batchjob_overview" src="http://www.doens.be/wp-content/uploads/2010/04/batchjob_overview.png" alt="" width="492" height="244" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/04/batch-job-performance-boost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip for overriding methods</title>
		<link>http://www.doens.be/2010/04/tip-for-overriding-methods/</link>
		<comments>http://www.doens.be/2010/04/tip-for-overriding-methods/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 05:00:44 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Best Practice]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=486</guid>
		<description><![CDATA[There is a simple and generic way to force overriding a method you created. To do so you just need create your new method and place a &#8216;throw error&#8217; statement in it. To finish you can add the static method missingOverride from the error class and the funcName() to your error. Now when this method [...]]]></description>
			<content:encoded><![CDATA[<p>There is a simple and generic way to force overriding a method you created. To do so you just need create your new method and place a &#8216;throw error&#8217; statement in it. To finish you can add the static method missingOverride from the<a href="http://msdn.microsoft.com/en-us/library/aa576695%28v=AX.50%29.aspx" target="_blank"> error class</a> and the funcName() to your error. Now when this method is called or the super() in you child class is called, you will get a error that you need to override your method.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> identifiername myMethod<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">throw</span>  error<span style="color: #000000;">&#40;</span>Error<span style="color: #00007f;">::</span><span style="color: #000000;">missingOverride</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">funcName</span><span style="color: #000000;">&#40;</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></pre></div></div>

<p>When you use this peace of code you will get the following error:<br />
<a href="http://www.doens.be/wp-content/uploads/2010/04/overrideMethod.png"><img class="size-full wp-image-488 alignnone" title="Missing Override Method" src="http://www.doens.be/wp-content/uploads/2010/04/overrideMethod.png" alt="" width="346" height="312" /></a></p>
<p><strong>Note: </strong>The error-class also has some other usefull static methods like: <a href="http://msdn.microsoft.com/en-us/library/aa573466%28v=AX.50%29.aspx">missingFormActiveBuffer</a>, <a href="http://msdn.microsoft.com/en-us/library/aa615299%28v=AX.50%29.aspx">missingOverload</a>, <a href="http://msdn.microsoft.com/en-us/library/aa849831%28v=AX.50%29.aspx">missingOverride</a>, <a href="http://msdn.microsoft.com/en-us/library/aa603172%28v=AX.50%29.aspx">missingParameter</a>, <a href="http://msdn.microsoft.com/en-us/library/aa625579%28v=AX.50%29.aspx">missingRecord</a> and my favorite <a href="http://msdn.microsoft.com/en-us/library/aa852215%28v=AX.50%29.aspx">wrongUseOfFunction</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/04/tip-for-overriding-methods/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create class from code</title>
		<link>http://www.doens.be/2010/03/create-class-from-code/</link>
		<comments>http://www.doens.be/2010/03/create-class-from-code/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 07:00:31 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Code Editor]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=396</guid>
		<description><![CDATA[Did you know that you can build/modify classes from code? It is actually not so hard, just use the ClassBuild-class. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 static void JeDoe_testClassBuild&#40;Args _args&#41; &#123; ClassBuild classBuild; ClassNode classNode; Str myCode; ; myCode [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that you can build/modify classes from code? It is actually not so hard, just use the <strong>ClassBuild</strong>-class.</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
15
16
17
18
19
20
21
22
</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_testClassBuild<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ClassBuild  classBuild;
    ClassNode   classNode;
    <span style="color: #0000ff;">Str</span>         myCode;
    ;
    myCode <span style="color: #00007f;">=</span>
@<span style="color: #ff0000;">&quot;
static void Main(Args _args)
{
    ;
    info('Hello World!');
}
&quot;</span>;
&nbsp;
    classBuild <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> ClassBuild<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;MyTest&quot;</span><span style="color: #00007f;">,</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">&#41;</span>;
    classBuild.<span style="color: #000000;">addMethod</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Main&quot;</span><span style="color: #00007f;">,</span> myCode<span style="color: #000000;">&#41;</span>;
&nbsp;
    classNode <span style="color: #00007f;">=</span> classBuild.<span style="color: #000000;">classNode</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    classNode.<span style="color: #000000;">AOTcompile</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    classNode.<span style="color: #000000;">AOTrun</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The sample above will create a new class MyTest with a &#8216;Hello World&#8217; Main-method and will actually save compile/save the code in the AOT and then run it. Cool?</p>
<p>Note: The SysDictClass/SysDictMethod-class can also help you creating proper classes and methods. Maybe I&#8217;ll blog about this later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/03/create-class-from-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About classes</title>
		<link>http://www.doens.be/2010/03/about-classes/</link>
		<comments>http://www.doens.be/2010/03/about-classes/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:00:17 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=377</guid>
		<description><![CDATA[In this post I will talk about classes and what you can do with them. Abstract class When you create a abstract class, you want to ensure that this class can not be instantiated. You wil have to create a sub-class that wil actually use the functionality. Example: abstract class MyClass &#123; &#125; Extends When [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I will talk about classes and what you can do with them.</p>
<ul>
<li><strong>Abstract class</strong></li>
</ul>
<p>When you create a abstract class, you want to ensure that this class can not be instantiated. You wil have to create a sub-class that wil actually use the functionality.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">abstract</span> <span style="color: #0000ff;">class</span> MyClass
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<ul>
<li><strong>Extends</strong></li>
</ul>
<p>When you want to create a new class that inherits methods/properties from a other class, you can &#8216;extend&#8217; the class. A typical example of a class you will extend from is the &#8216;RunBaseBatch&#8217;-class. When you do this, you will automatically be able to schedule your class.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> MyClass <span style="color: #0000ff;">extends</span> RunBaseBatch
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<ul>
<li><strong>Implements / Interface</strong></li>
</ul>
<p>Sometimes you want to create a blue-print for new classes by creating a &#8216;Interface&#8217; class. The you just need to &#8216;Implement&#8217; the blueprint in you&#8217;re new class.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> MyClass <span style="color: #0000ff;">implements</span> SysComparable
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/03/about-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

