<?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; Forms</title>
	<atom:link href="http://www.doens.be/tag/forms/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>How to make methods on fields disappear (aka a bug)</title>
		<link>http://www.doens.be/2010/08/how-to-make-methods-on-fields-disappear-aka-a-bug/</link>
		<comments>http://www.doens.be/2010/08/how-to-make-methods-on-fields-disappear-aka-a-bug/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 05:00:30 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[MorphX]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=647</guid>
		<description><![CDATA[Me and some of my colleagues are currently working with a customer on a Ax 2009 SP1 RU4. The other day we came to the conclusion that the modified methods on fields in a form suddenly disappeared. I know, you should write as less as possible code on a form, but sometimes there is no way [...]]]></description>
			<content:encoded><![CDATA[<p>Me and some of my colleagues are currently working with a customer on a Ax 2009 SP1 RU4. The other day we came to the conclusion that the modified methods on fields in a form suddenly disappeared. I know, you should write as less as possible code on a form, but sometimes there is no way around this.</p>
<p>After some research we found a reproduction how these methods suddenly disappeared:</p>
<ol>
<li>Go      tot the AOT and chose a form</li>
<li>Open      the [FORM] -&gt; Data Sources -&gt; [TABLE] -&gt; Fields -&gt; [A FIELD] -node</li>
<li>Add      a method <em>(for example the      modified-method)</em></li>
<li>Save your form</li>
<li>Go      to the properties of the table in the datasource</li>
<li>Place      your cursor in the table property <em>(properties      window)</em></li>
<li>Push ENTER</li>
</ol>
<p>The result is that the table will be reloaded in the form and all methods you created on the fields will be gone. So here you have another reason why you shouldn’t write lots of code on your forms. You can only lose it by accident.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/08/how-to-make-methods-on-fields-disappear-aka-a-bug/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Expressions in query ranges &#8211; limitations</title>
		<link>http://www.doens.be/2010/04/expressions-in-query-ranges-limitations/</link>
		<comments>http://www.doens.be/2010/04/expressions-in-query-ranges-limitations/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 05:00:50 +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[Forms]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[QueryRun]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=482</guid>
		<description><![CDATA[When you want to construct a query-object that contains OR-conditions, you can construct something like this: 1 2 3 4 5 6 queryBuildRange.value&#40;strFmt&#40;'((%1 == %2) &#124;&#124; ((%1 == %3) &#38;&#38; (%4 == &#34;%5&#34;)))', fieldStr&#40;InventTable, ItemType&#41;, any2int&#40;ItemType::Service&#41;, any2int&#40;ItemType::Item&#41;, fieldStr&#40;InventTable, ProjCategoryId&#41;, queryValue&#40;&#34;Spares&#34;&#41;&#41;&#41;; (you can find more info on Axaptapedia: Expressions in query ranges) Now there is a [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to construct a query-object that contains OR-conditions, you can construct something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">queryBuildRange.<span style="color: #000000;">value</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">strFmt</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'((%1 == %2) || ((%1 == %3) &amp;&amp; (%4 == &quot;%5&quot;)))'</span><span style="color: #00007f;">,</span>
                    <span style="color: #0000ff;">fieldStr</span><span style="color: #000000;">&#40;</span>InventTable<span style="color: #00007f;">,</span> ItemType<span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span>
                    <span style="color: #0000ff;">any2int</span><span style="color: #000000;">&#40;</span>ItemType<span style="color: #00007f;">::</span><span style="color: #000000;">Service</span><span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span>
                    <span style="color: #0000ff;">any2int</span><span style="color: #000000;">&#40;</span>ItemType<span style="color: #00007f;">::</span><span style="color: #000000;">Item</span><span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span>
                    <span style="color: #0000ff;">fieldStr</span><span style="color: #000000;">&#40;</span>InventTable<span style="color: #00007f;">,</span> ProjCategoryId<span style="color: #000000;">&#41;</span><span style="color: #00007f;">,</span>
                    queryValue<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;Spares&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>(you can find more info on <a href="http://www.axaptapedia.com/Expressions_in_query_ranges">Axaptapedia: Expressions in query ranges</a>)</p>
<p>Now there is a limitation to this way of working. When the generated string in the queryBuildRange.value is longer than 250 characters (the length of the range EDT), Ax cuts the generated string off when you open the &#8216;modify query&#8217; dialog. I have tried to enlarging the EDT, but is not a good solution. The error does not occure when you open the &#8216;modify query&#8217; dialog, but it occures when you close it.<br />
A small (but limited) work-around could be to make the name of the datasources on the form/report where you want to apply this trick smaller. I hope to find a better solution, but this does the trick for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/04/expressions-in-query-ranges-limitations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting propperties on a FormControl without AutoDeclaration</title>
		<link>http://www.doens.be/2010/03/setting-propperties-on-a-formcontrol-without-autodeclaration/</link>
		<comments>http://www.doens.be/2010/03/setting-propperties-on-a-formcontrol-without-autodeclaration/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 07:00:35 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=411</guid>
		<description><![CDATA[When you want to set a property of a control on a form without setting the property AutoDeclaration = yes. You can address the control trough the following code, knowing that element is a FormRun-object: element.design&#40;&#41;.controlName&#40;&#34;btnOk&#34;&#41;.visible&#40;false&#41;;]]></description>
			<content:encoded><![CDATA[<p>When you want to set a property of a control on a form without setting the property AutoDeclaration = yes. You can address the control trough the following code, knowing that element is a FormRun-object:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;">element.<span style="color: #000000;">design</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">controlName</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">&quot;btnOk&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">visible</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">false</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/03/setting-propperties-on-a-formcontrol-without-autodeclaration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Catching a key-press</title>
		<link>http://www.doens.be/2010/03/catching-a-key-press/</link>
		<comments>http://www.doens.be/2010/03/catching-a-key-press/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 07:00:50 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Macro]]></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=391</guid>
		<description><![CDATA[When you want to catch a key-stroke on a form, you can override the method task() The default method will look like this: public int task&#40;int _taskId&#41; &#123; int ret; ret = super&#40;_taskId&#41;; // write you're code here return ret; &#125; Now you just need to check the _taskId, to know witch key you have [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to catch a key-stroke on a form, you can override the method <strong>task()</strong><br />
The default method will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">int</span> task<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> _taskId<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">int</span> ret;
    ret <span style="color: #00007f;">=</span> <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span>_taskId<span style="color: #000000;">&#41;</span>;
    <span style="color: #007f00;">// write you're code here</span>
    <span style="color: #0000ff;">return</span> ret;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now you just need to check the <em>_taskId</em>, to know witch key you have stroke. You can compare this withe the values from the Task-macro.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #007f00;">// Task-ID values, to be used with formControl's</span>
<span style="color: #007f00;">// return value from the method task()</span>
<span style="color: #007f00;">//--------------------------------------------------------</span>
&nbsp;
#define.<span style="color: #000000;">taskF1</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">257</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskCtrlQ</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">264</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskEnter</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">288</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskShiftEnter</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">307</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskNew</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">260</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskSave</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">272</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskShortCutMenuKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">519</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskAlt</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">520</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskCut</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">770</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskCopy</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">771</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskPaste</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">772</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskDeleteKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">773</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskSelectAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">778</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskUndo</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">769</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskRedo</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">791</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskArrowUp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1281</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskArrowDown</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1282</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskArrowLeft</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1283</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskArrowRight</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1284</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #007f00;">// PgUp and PgDn are the numerical keyboard page up and page down commands.</span>
#define.<span style="color: #000000;">taskPgUp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1285</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskPgDn</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1286</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskEsc</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">1313</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskNextRecord</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2817</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskPrevRecord</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2818</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskDeleteRecord</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2832</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskPageDown</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2819</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskPageUp</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2820</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskTab</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2827</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskNext</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2827</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskPrev</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2828</span><span style="color: #000000;">&#41;</span>
&nbsp;
#define.<span style="color: #000000;">taskShortCutMenuFilter</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2844</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskShortCutMenuFind</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">799</span><span style="color: #000000;">&#41;</span>
#define.<span style="color: #000000;">taskFilter</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">2837</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #007f00;">// max task id</span>
#define.<span style="color: #000000;">taskLast</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">8191</span><span style="color: #000000;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/03/catching-a-key-press/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Counting the number of records in a QueryRun</title>
		<link>http://www.doens.be/2010/03/counting-the-number-of-records-in-a-queryrun/</link>
		<comments>http://www.doens.be/2010/03/counting-the-number-of-records-in-a-queryrun/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 07:00:39 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[QueryRun]]></category>
		<category><![CDATA[X++]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=386</guid>
		<description><![CDATA[When you want to count the number of records that are currently displayed on a form, and you have only one data source, just call the static method countTotal() from the SysQuery-class. public void executeQuery&#40;&#41; &#123; ; super&#40;&#41;; info&#40;int2str&#40;SysQuery::countTotal&#40;EmplTable_ds.queryRun&#40;&#41;&#41;&#41;&#41;; &#125; But when you want to do the same when you joined multiple data sources, you [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to count the number of records that are currently displayed on a form, and you have only one data source, just call the static method <strong>countTotal()</strong> from the <strong>SysQuery</strong>-class.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> executeQuery<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    info<span style="color: #000000;">&#40;</span>int2str<span style="color: #000000;">&#40;</span>SysQuery<span style="color: #00007f;">::</span><span style="color: #000000;">countTotal</span><span style="color: #000000;">&#40;</span>EmplTable_ds.<span style="color: #000000;">queryRun</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;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>But when you want to do the same when you joined multiple data sources, you will actually have to loop trough the whole selection. You can do this easily by calling <strong>countLoops()</strong> on the <strong>SysQuery</strong>-class. Keep in mind that this has a serious influence on your performance.</p>

<div class="wp_syntax"><div class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> executeQuery<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    info<span style="color: #000000;">&#40;</span>int2str<span style="color: #000000;">&#40;</span>SysQuery<span style="color: #00007f;">::</span><span style="color: #000000;">countLoops</span><span style="color: #000000;">&#40;</span>EmplTable_ds.<span style="color: #000000;">queryRun</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;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/03/counting-the-number-of-records-in-a-queryrun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with numbersequences &#8211; On forms</title>
		<link>http://www.doens.be/2010/02/working-with-numbersequences-on-forms/</link>
		<comments>http://www.doens.be/2010/02/working-with-numbersequences-on-forms/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 17:00:59 +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[Forms]]></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=358</guid>
		<description><![CDATA[When you want to implement NumberSequences in a Ax form (new numbersequence when you create a record etc.) you can just implement the ‘numberSeqFormHandler’. Step-by-step: Define a object of the type &#8216;NumberSeqFormHandler&#8216; in the ClassDeclaration of the form 1 2 3 4 public class FormRun extends ObjectRun &#123;     NumberSeqFormHandler            numberSeqFormHandler; &#125; Create a new [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to implement NumberSequences in a Ax form (new numbersequence when you create a record etc.) you can just implement the ‘<a href="http://msdn.microsoft.com/en-us/library/aa632953.aspx"><em>numberSeqFormHandler</em></a>’.</p>
<p>Step-by-step:<span id="more-358"></span></p>
<ul>
<li>Define a object of the type &#8216;<em>NumberSeqFormHandler</em>&#8216; in the <em>ClassDeclaration</em> of the form

<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> <span style="color: #0000ff;">class</span> FormRun <span style="color: #0000ff;">extends</span> ObjectRun
<span style="color: #000000;">&#123;</span>
    NumberSeqFormHandler            numberSeqFormHandler;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Create a new method on your form that create a new instance of the ‘<em>numberSeqFormHandler’</em> object or creates a new object when it isn’t instanciated.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;">NumberSeqFormHandler numberSeqFormHandler<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #00007f;">!</span>numberSeqFormHandler<span style="color: #000000;">&#41;</span>
        numberSeqFormHandler <span style="color: #00007f;">=</span> NumberSeqFormHandler<span style="color: #00007f;">::</span><span style="color: #000000;">newForm</span><span style="color: #000000;">&#40;</span>TestParameters<span style="color: #00007f;">::</span><span style="color: #000000;">numRefTEST</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">NumberSequence</span><span style="color: #00007f;">,</span>
                                                             element<span style="color: #00007f;">,</span>
                                                             TestTable_DS<span style="color: #00007f;">,</span>
                                                             <span style="color: #0000ff;">fieldnum</span><span style="color: #000000;">&#40;</span>TestTable<span style="color: #00007f;">,</span>TEST<span style="color: #000000;">&#41;</span>
                                                            <span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">return</span> numberSeqFormHandler;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Complete some of the existing methods with the correct method of the &#8216;<em>numberSeqFormHandler</em>&#8216; object:
<ul>
<li>Table : Create() &#8211;> The user creates a new record in the data source.

<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;">public</span> <span style="color: #0000ff;">void</span> create<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">boolean</span> _append <span style="color: #00007f;">=</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceCreatePre</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span>_append<span style="color: #000000;">&#41;</span>;
    element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceCreate</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Table : Delete() &#8211;> The user deletes a record in the data source.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> delete<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceDelete</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Table : Write() &#8211;> The user inserts a new record or updates an existing one.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> write<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #0000ff;">ttsbegin</span>;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceWrite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">ttscommit</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Table : validatWrite() &#8211;> new or updated record is to be written.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">boolean</span> validateWrite<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">boolean</span> ret;
    ;
    ret <span style="color: #00007f;">=</span> <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    ret <span style="color: #00007f;">=</span> element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceValidateWrite</span><span style="color: #000000;">&#40;</span>ret<span style="color: #000000;">&#41;</span> <span style="color: #00007f;">&amp;</span>amp;<span style="color: #00007f;">&amp;</span>amp; ret;
    <span style="color: #0000ff;">return</span> ret;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Table : linkActive() à The user selects a new record in a form that has a data source linked to another data source.

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> linkActive<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    element.<span style="color: #000000;">numberSeqFormHandler</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">formMethodDataSourceLinkActive</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
<li>Close() &#8211;> The form is closed.

<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;">public</span> <span style="color: #0000ff;">void</span> close<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    ;
    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>numberSeqFormHandler<span style="color: #000000;">&#41;</span>
        numberSeqFormHandler.<span style="color: #000000;">formMethodClose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/working-with-numbersequences-on-forms/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>Lock on form elements in Dynamics Ax</title>
		<link>http://www.doens.be/2009/11/lock-on-form-elemnts-in-dynamics-ax/</link>
		<comments>http://www.doens.be/2009/11/lock-on-form-elemnts-in-dynamics-ax/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 20:18:30 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[User interaction]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=286</guid>
		<description><![CDATA[Some end-users like to make their own modifications on their forms (right-click on the form &#8211;&#62; setup). Last week I had a customer that was not able to do this trick any more. After some research and a tip from a colleague, I came to the conclusion that this had something to do with overriding [...]]]></description>
			<content:encoded><![CDATA[<p>Some end-users like to make their own modifications on their forms (right-click on the form &#8211;&gt; setup). Last week I had a customer that was not able to do this trick any more. After some research and a tip from a colleague, I came to the conclusion that this had something to do with overriding the methods tabChange() and tabChanged() on the form.</p>
<p>Solution:<br />
Use the methods pageActivated() / allowPageDeactivate() instead.</p>
<p>Source / More info:<br />
<a href="http://dynamics-ax.blogspot.com/2007/06/yellow-lock-in-dynamics-ax-401.html">http://dynamics-ax.blogspot.com/2007/06/yellow-lock-in-dynamics-ax-401.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2009/11/lock-on-form-elemnts-in-dynamics-ax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

