<?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; Data Types</title>
	<atom:link href="http://www.doens.be/tag/data-types/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>Working with numbersequences &#8211; New Module</title>
		<link>http://www.doens.be/2010/02/working-with-numbersequences-new-module/</link>
		<comments>http://www.doens.be/2010/02/working-with-numbersequences-new-module/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 17:30:28 +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[Data Types]]></category>
		<category><![CDATA[Number Sequence]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=323</guid>
		<description><![CDATA[In a previous post I explained how to create a new Number Sequence in a existing module (Working with numbersequences – new NumberSequence). In this post I will explain how you can create a new Number Sequence-module. I will create a new module called TEST (lack of inspiration). Step-By-Step: First of all extend the existing [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post I explained how to create a new Number Sequence in a existing module (<a href="http://www.doens.be/2009/05/working-with-numbersequences-new-numbersequence/" target="_self"><em>Working with numbersequences – new NumberSequence</em></a>). In this post I will explain how you can create a new Number Sequence-module.<br />
I will create a new module called TEST (lack of inspiration).</p>
<p>Step-By-Step:<span id="more-323"></span></p>
<ul>
<li>First of all extend the existing Enum &#8216;NumberSeqModule&#8217; with a new value &#8216;TEST&#8217; and enter the name of the module in the Label-property<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_Enum.jpg" target="_blank"><img class="alignnone size-full wp-image-324" title="NumberSequence_Enum" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_Enum.jpg" alt="" width="121" height="450" /></a></li>
<li>create a new class called &#8216;<em>NumberSeqReference_TEST</em>&#8216; and that extends from &#8216;<em>NumberSeqReference</em>&#8216;.</li>
<li>Add a static method called &#8216;numberSeqModule&#8217; and return the new value of the Enum.

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> NumberSeqModule numberSeqModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">return</span> NumberSeqModule<span style="color: #00007f;">::</span><span style="color: #000000;">TEST</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

</li>
<li>Override the Method loadModule and enter the necessary code for all the Number Sequences in your new module.

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">void</span> loadModule<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    NumberSequenceReference numRef;
    ;
    <span style="color: #007f00; font-style: italic;">/* TEST */</span>
    numRef.<span style="color: #000000;">DataTypeId</span>               <span style="color: #00007f;">=</span> typeId2ExtendedTypeId<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">typeid</span><span style="color: #000000;">&#40;</span>TEST<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    numRef.<span style="color: #000000;">ReferenceHelp</span>            <span style="color: #00007f;">=</span> <span style="color: #0000ff;">literalstr</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@SYS31561&quot;</span><span style="color: #000000;">&#41;</span>;
    numRef.<span style="color: #000000;">WizardContinuous</span>         <span style="color: #00007f;">=</span> <span style="color: #0000ff;">false</span>;
    numRef.<span style="color: #000000;">WizardManual</span>             <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
    numRef.<span style="color: #000000;">WizardAllowChangeDown</span>    <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
    numRef.<span style="color: #000000;">WizardAllowChangeUp</span>      <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
    numRef.<span style="color: #000000;">WizardHighest</span>            <span style="color: #00007f;">=</span> <span style="color: #000000;">999999</span>;
    numRef.<span style="color: #000000;">SortField</span>                <span style="color: #00007f;">=</span> <span style="color: #000000;">1</span>;
&nbsp;
    this.<span style="color: #000000;">create</span><span style="color: #000000;">&#40;</span>numRef<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

</li>
<li>In the class NumberSeqReference, you have to add some new lines so the system recognizes your new module. Complete the method construct &amp; moduleList.<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSeqReference_construct2.jpg" target="_blank"><img class="alignnone size-full wp-image-333" title="NumberSequence_NumberSeqReference_construct2" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSeqReference_construct2.jpg" alt="" width="450" height="171" /></a><br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSeqReference_moduleList2.jpg" target="_blank"><img class="alignnone size-full wp-image-334" title="NumberSequence_NumberSeqReference_moduleList2" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSeqReference_moduleList2.jpg" alt="" width="450" height="171" /></a></li>
<li>Open the NumberSequence-form under BASIC &#8211; SETUP &#8211; NUMBER SEQUENCES &#8211; NUMBER SEQUENCES<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_01.jpg" target="_blank"><img class="alignnone size-full wp-image-327" title="NumberSequence_NumberSequence_form_01" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_01.jpg" alt="" width="177" height="250" /></a></li>
<li>Open the Number Sequence-wizard<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_02_wizard.jpg" target="_blank"><img class="alignnone size-full wp-image-328" title="NumberSequence_NumberSequence_form_02_wizard" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_02_wizard.jpg" alt="" width="450" height="267" /></a></li>
<li>Follow all the steps of the wizard and finish<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_01.jpg" target="_blank"><img class="alignnone size-full wp-image-330" title="NumberSequence_NumberSequence_wizard_01" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_01.jpg" alt="" width="350" height="387" /></a><br />
 <a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_03.jpg" target="_blank"><img class="alignnone size-full wp-image-332" title="NumberSequence_NumberSequence_wizard_03" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_03.jpg" alt="" width="450" height="302" /></a><br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_02.jpg" target="_blank"><img class="alignnone size-full wp-image-331" title="NumberSequence_NumberSequence_wizard_02" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_wizard_02.jpg" alt="" width="450" height="302" /></a></li>
<li>See how the new Number Sequence in the Number Sequence-form<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_03_wizard.jpg" target="_blank"><img class="alignnone size-full wp-image-329" title="NumberSequence_NumberSequence_form_03_wizard" src="http://www.doens.be/wp-content/uploads/2010/02/NumberSequence_NumberSequence_form_03_wizard.jpg" alt="" width="450" height="267" /></a></li>
</ul>
<p>From now on you can use your new Numbersequence and the module.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/working-with-numbersequences-new-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maximum value RecId</title>
		<link>http://www.doens.be/2010/02/maximum-value-recid/</link>
		<comments>http://www.doens.be/2010/02/maximum-value-recid/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 17:00:12 +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[Data Types]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=313</guid>
		<description><![CDATA[Did you ever wonder what the maximum value of a RecId was? In Ax3.0 it is pritty simple. You know that the RecId was a int value and with the function &#8216;maxInt()&#8217;, you get the value. In Ax4.0 and higher, the RecId is changed from a regular int to in64. There is no such function [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever wonder what the maximum value of a RecId was?</p>
<p>In Ax3.0 it is pritty simple. You know that the RecId was a int value and with the function &#8216;maxInt()&#8217;, you get the value.</p>
<p>In Ax4.0 and higher, the RecId is changed from a regular int to in64. There is no such function as &#8216;maxInt64()&#8217; so you cant use this. In the &#8216;Global&#8217;, I found a method called &#8216;maxRecId()&#8217;.<br />
So you just call this method and you will see that the maximum value of a RecId is 9223372036854775807 <em>(I hope I didn&#8217;t mistype)</em> or 2^63-1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/maximum-value-recid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Line Number</title>
		<link>http://www.doens.be/2010/02/line-number/</link>
		<comments>http://www.doens.be/2010/02/line-number/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 07:00:19 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=299</guid>
		<description><![CDATA[When you want to create a table were you want to remain the position of the records you create (like the lineNum field on the SalesLine), you just need to define a field on your new table as a &#8216;CounterField&#8216;. Step-by-step: You add a new field to your table that extends from the ExtendedDataType &#8216;LineNum&#8216;. [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to create a table were you want to remain the position of the records you create (like the lineNum field on the SalesLine), you just need to define a field on your new table as a &#8216;<a title="Counterfield" href="http://msdn.microsoft.com/en-us/library/aa634101.aspx" target="_blank">CounterField</a>&#8216;.</p>
<p>Step-by-step:<span id="more-299"></span></p>
<ul>
<li>You add a new field to your table that extends from the ExtendedDataType &#8216;<a href="http://msdn.microsoft.com/en-us/library/aa633520.aspx" target="_blank">LineNum</a>&#8216;. This field has the type Real.<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/LineNum_field.jpg"><img class="alignnone size-full wp-image-302" title="New field LineNum" src="http://www.doens.be/wp-content/uploads/2010/02/LineNum_field.jpg" alt="" width="393" height="520" /></a></li>
<li>You create a new index with this field<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/LineNum_Index.jpg"><img class="alignnone size-full wp-image-300" title="LineNum Index" src="http://www.doens.be/wp-content/uploads/2010/02/LineNum_Index.jpg" alt="" width="164" height="292" /></a></li>
<li>On the form you add your table as a DataSource and set the following <a title="DataSource properies" href="http://msdn.microsoft.com/en-us/library/aa676742.aspx" target="_blank">properties</a>:
<ul>
<li>Index : the index with the lineNum-field</li>
<li>CounterField : your LineNum-field<br />
<a href="http://www.doens.be/wp-content/uploads/2010/02/LineNum_DataSource.jpg"><img class="alignnone size-full wp-image-301" title="LineNum_DataSource" src="http://www.doens.be/wp-content/uploads/2010/02/LineNum_DataSource.jpg" alt="" width="393" height="384" /></a></li>
</ul>
</li>
</ul>
<p>Now automaticly when you create a new record, the lineNum gets the value &#8217;1&#8242;. When you create a record at the end of the table it wil get the value &#8217;2&#8242;, &#8217;3&#8242;, &#8230; In the beginning of the table, the value&#8217;s will be &#8216;-1&#8242;, &#8216;-2&#8242;, &#8230;</p>
<p>If you create a new record between &#8217;3&#8242; and &#8217;4&#8242;, the LineNum-value will be &#8217;3.5&#8242;.</p>
<p>When you want a example of this, you need to look at the &#8216;SalesTable&#8217;-form and the DataSource &#8216;SalesLine&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/line-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select a record from a table when you only have the tableId</title>
		<link>http://www.doens.be/2009/07/select-a-record-from-a-table-when-you-only-have-the-tableid/</link>
		<comments>http://www.doens.be/2009/07/select-a-record-from-a-table-when-you-only-have-the-tableid/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 15:34:57 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Data Types]]></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=151</guid>
		<description><![CDATA[The following code can provide you a generic way to update a table when you only have the tableId. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public Common findRecord&#40;TableId _tableId, RecId _recId, Boolean _forUpdate = false&#41; &#123; Common      common; DictTable   dictTable; ; dictTable = new DictTable&#40;_tableId&#41;; common [...]]]></description>
			<content:encoded><![CDATA[<p>The following code can provide you a generic way to update a table when you only have the tableId.</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
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> Common findRecord<span style="color: #000000;">&#40;</span>TableId _tableId<span style="color: #00007f;">,</span> RecId _recId<span style="color: #00007f;">,</span> <span style="color: #0000ff;">Boolean</span> _forUpdate <span style="color: #00007f;">=</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    Common      common;
    DictTable   dictTable;
    ;
    dictTable <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> DictTable<span style="color: #000000;">&#40;</span>_tableId<span style="color: #000000;">&#41;</span>;
    common <span style="color: #00007f;">=</span> dictTable.<span style="color: #000000;">makeRecord</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    common.<span style="color: #000000;">selectForUpdate</span><span style="color: #000000;">&#40;</span>_forUpdate<span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #0000ff;">select</span> common
    <span style="color: #0000ff;">where</span> common.<span style="color: #000000;">RecId</span> <span style="color: #00007f;">==</span> _recId;
&nbsp;
    <span style="color: #0000ff;">return</span> common;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>If you want, you can even update fields in this common record. You can Access/edit these fields by using their Name or FieldNum. The method below will update a specific field in a table.</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
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> updateValue<span style="color: #000000;">&#40;</span>TableId _tableId<span style="color: #00007f;">,</span> RecId _recId<span style="color: #00007f;">,</span> <span style="color: #0000ff;">str</span> _field<span style="color: #00007f;">,</span> <span style="color: #0000ff;">AnyType</span> _value<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    Common      common;
    <span style="color: #0000ff;">Int</span>         fieldId;
    ;
    <span style="color: #0000ff;">ttsbegin</span>;
    common <span style="color: #00007f;">=</span> findRecord<span style="color: #000000;">&#40;</span>_tableId<span style="color: #00007f;">,</span> _recId<span style="color: #00007f;">,</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">&#41;</span>;
    fieldId <span style="color: #00007f;">=</span> <span style="color: #0000ff;">fieldname2id</span><span style="color: #000000;">&#40;</span>_tableId<span style="color: #00007f;">,</span>_field<span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>fieldId <span style="color: #00007f;">&amp;</span>amp;<span style="color: #00007f;">&amp;</span>amp; _value<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        common.<span style="color: #000000;">&#40;</span>fieldId<span style="color: #000000;">&#41;</span> <span style="color: #00007f;">=</span> _value;
        common.<span style="color: #000000;">update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000ff;">ttscommit</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2009/07/select-a-record-from-a-table-when-you-only-have-the-tableid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using FilePath on a form</title>
		<link>http://www.doens.be/2009/06/using-filepath-on-a-form/</link>
		<comments>http://www.doens.be/2009/06/using-filepath-on-a-form/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 15:17:27 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[FilePath]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=144</guid>
		<description><![CDATA[When you want a filebrowser on your form and you only added a field that extends from the Extended Data Type FilePath, you wil get a stack-trace/error message when you click on the folder icon. Don&#8217;t panic, there is nothing wrong with your AX. Like the error explains you just need to provide the form [...]]]></description>
			<content:encoded><![CDATA[<p>When you want a filebrowser on your form and you only added a field that extends from the Extended Data Type FilePath, you wil get a stack-trace/error message when you click on the folder icon. Don&#8217;t panic, there is nothing wrong with your AX. Like the error explains you just need to provide the form with the method filePathLookupTitle.</p>
<p><a href="http://www.doens.be/wp-content/uploads/2009/06/error_formRun_filePathLookupTitle1.PNG"><img class="size-full wp-image-147   alignnone" style="margin: 0px; border: 0px;" title="error_formRun_filePathLookupTitle" src="http://www.doens.be/wp-content/uploads/2009/06/error_formRun_filePathLookupTitle1.PNG" alt="error_formRun_filePathLookupTitle" width="400" height="266" /></a></p>

<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;"><span style="color: #0000ff;">public</span> LabelString filenameLookupTitle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #ff0000;">&quot;Select Import File&quot;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Normally this should solve your problem.</p>
<p>There are some more methods you can add to control the file lookup:</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
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> LabelString filenameLookupFilename<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #ff0000;">&quot;&quot;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">public</span> FileNameFilter filenameLookupFilter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    FileNameFilter filter;
    filter <span style="color: #00007f;">=</span> <span style="color: #000000;">&#91;</span><span style="color: #ff0000;">'All FIles'</span><span style="color: #00007f;">,</span><span style="color: #ff0000;">'*.*'</span><span style="color: #000000;">&#93;</span>;
    <span style="color: #0000ff;">return</span> filter;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">public</span> LabelString filenameLookupInitialPath<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #ff0000;">&quot;&quot;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">public</span> LabelString filePathLookupTitle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #ff0000;">&quot;Select Document Path&quot;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2009/06/using-filepath-on-a-form/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working with numbersequences – new NumberSequence</title>
		<link>http://www.doens.be/2009/05/working-with-numbersequences-new-numbersequence/</link>
		<comments>http://www.doens.be/2009/05/working-with-numbersequences-new-numbersequence/#comments</comments>
		<pubDate>Tue, 05 May 2009 18:00:12 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[Number Sequence]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=120</guid>
		<description><![CDATA[When you want to create a new NumberSequence in AX you have to do the following steps: 1. Create a new Extended Data Type (EDT). Often this EDT extends from num. (this step is not mandatory, but it is a best practice) 2. Discide in witch module this new Number Sequence Reference (classes NumberSeqReference_&#8230;) should [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to create a new NumberSequence in AX you have to do the following steps:<br />
1. Create a new Extended Data Type (EDT). Often this EDT extends from num. (this step is not mandatory, but it is a best practice)</p>
<p>2. Discide in witch module this new Number Sequence Reference (classes NumberSeqReference_&#8230;) should be included and find the corresponding NumberSeqReference class. (ex. module sales &#8211;&gt; NumberSeqReference_SalesOrder)</p>
<p>3. The loadModule() method shows a number of blocks of code, which creates records in the table NumberSequenceReference.</p>
<p>4.Copy a block and change the following fields:<br />
* <strong>DataTypeID </strong>is the type Id of the new data type.<br />
* <strong>referenceLabel </strong>is the description shown in the left column of the Number sequence tab on the parameters form.<br />
* <strong>referenceHelp </strong>is the longer description of the reference shown in the top part of the Number sequence tab of the parameters form.<br />
* <strong>sortfield </strong>defines the sequence that the references are displayed on the Number sequence tab of the parameters form.<br />
* The <strong>wizard fields</strong> are default values when using the wizard to create a numbersequenceexample:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">numRef.<span style="color: #000000;">DataTypeId</span> <span style="color: #00007f;">=</span> typeId2ExtendedTypeId<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">typeid</span><span style="color: #000000;">&#40;</span>NewType<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
numRef.<span style="color: #000000;">ReferenceLabel</span> <span style="color: #00007f;">=</span> <span style="color: #0000ff;">literalstr</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@...&quot;</span><span style="color: #000000;">&#41;</span>;
numRef.<span style="color: #000000;">ReferenceHelp</span> <span style="color: #00007f;">=</span> <span style="color: #0000ff;">literalstr</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;@...&quot;</span><span style="color: #000000;">&#41;</span>;
numRef.<span style="color: #000000;">WizardManual</span> <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
numRef.<span style="color: #000000;">WizardAllowChangeDown</span> <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
numRef.<span style="color: #000000;">WizardAllowChangeUp</span> <span style="color: #00007f;">=</span> NoYes<span style="color: #00007f;">::</span><span style="color: #000000;">No</span>;
numRef.<span style="color: #000000;">SortField</span> <span style="color: #00007f;">=</span> #;
&nbsp;
this.<span style="color: #000000;">create</span><span style="color: #000000;">&#40;</span>numRef<span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>5. Create a static method on the parameter table that will be used to retrieve the reference. These methods usually start with &#8220;numref&#8221;.<br />
example:</p>

<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;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">client</span> <span style="color: #0000ff;">server</span> NumberSequenceReference  numRefNewType<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0000ff;">return</span> NumberSeqReference<span style="color: #00007f;">::</span><span style="color: #000000;">findReference</span><span style="color: #000000;">&#40;</span>typeId2ExtendedTypeId<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">typeid</span><span style="color: #000000;">&#40;</span>NewType<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></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2009/05/working-with-numbersequences-new-numbersequence/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Type of Anytpe enum</title>
		<link>http://www.doens.be/2009/04/type-of-anytpe-enum/</link>
		<comments>http://www.doens.be/2009/04/type-of-anytpe-enum/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 21:20:04 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=53</guid>
		<description><![CDATA[Normaly you try to avoid using AnyType variables, but sometimes you are forced to use them. When you use a AnyType enum and you want to cast it to it&#8217;s actual data type, be sure you cast it to the right type to prevent stack-traces. You can get the enumId from a AnyType-enum by using [...]]]></description>
			<content:encoded><![CDATA[<p>Normaly you try to <a href="http://www.artofcreation.be/2009/04/07/wrong-argument-types-in-variable-assignment-part-2/" target="_blank"><strong>avoid using AnyType variables</strong></a>, but sometimes you are forced to use them. When you use a AnyType enum and you want to cast it to it&#8217;s actual data type, be sure you cast it to the right type to prevent stack-traces. You can get the enumId from a AnyType-enum by using the <strong>DictEnum::value2id(AnyType _value)</strong> -function. Then you can compare it with the <strong>enumnum(EnumType)</strong> to check if it is the right type.</p>
<p>In code this check could look like this:</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> testAnyTypeEnumCasting<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    DocumentStatus  docStatus;
    <span style="color: #0000ff;">Anytype</span>         any <span style="color: #00007f;">=</span> DocumentStatus<span style="color: #00007f;">::</span><span style="color: #000000;">Invoice</span>;
    ;
    <span style="color: #0000ff;">switch</span> <span style="color: #000000;">&#40;</span>DictEnum<span style="color: #00007f;">::</span><span style="color: #000000;">value2id</span><span style="color: #000000;">&#40;</span>any<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0000ff;">case</span> <span style="color: #0000ff;">enumnum</span><span style="color: #000000;">&#40;</span>DocumentStatus<span style="color: #000000;">&#41;</span> <span style="color: #00007f;">:</span>
            docStatus <span style="color: #00007f;">=</span> any;
            <span style="color: #0000ff;">break</span>;
        <span style="color: #0000ff;">case</span> <span style="color: #0000ff;">enumnum</span><span style="color: #000000;">&#40;</span>...<span style="color: #000000;">&#41;</span> <span style="color: #00007f;">:</span>
            ...
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2009/04/type-of-anytpe-enum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

