<?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; DictTable</title>
	<atom:link href="http://www.doens.be/tag/dicttable/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>A few things you should know about temporary tables</title>
		<link>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/</link>
		<comments>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/#comments</comments>
		<pubDate>Mon, 10 May 2010 05:00:43 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[DictTable]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[X++]]></category>

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

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

</li>
</ul>
</div>
<div>Things to know:</div>
<ul>
<li>When you declare a buffer of a record of temporary table type, the table does not contain any values.</li>
<li>Memmory and filespace aren&#8217;t allocated for a temporary table till the first record is inserted. This means that you have to watch out for client/server problems.<br />
When the first record is inserted in a buffer on the client tier, the memory is allocated there. All actions (insert / update / delete) to this buffer will run trough that tier, so try to reduce round-trips and improve your performance.</li>
<li>When you declare 2 different buffers of the same temporary table, they will both have a life of their own. To share the date between the tables use the setTmpData method.<br />
for example: tmpCommonBuffer1.setTmpData(tmpCommonBuffer2);</li>
<li>You can&#8217;t (normally) set up logging on temporary tables.</li>
<li>Use the method isTmp() to know if a record is temporary or not (true &#8211;&gt; temporary, false &#8211;&gt; phisical)</li>
</ul>
<p><strong>My opinion:</strong> Temporary tables are very useful and can help you to easily manipulate data you don&#8217;t need store permanently, but watch out where and how you use them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/05/a-few-things-you-should-know-about-temporary-tables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>List of mandatory fields on a table</title>
		<link>http://www.doens.be/2010/02/list-of-mandatory-fields-on-a-table/</link>
		<comments>http://www.doens.be/2010/02/list-of-mandatory-fields-on-a-table/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 07:00:28 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[AOT]]></category>
		<category><![CDATA[Ax 4.0]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></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=369</guid>
		<description><![CDATA[When you want a list of all the mandatory field on table X, yould check all the properties on the table fields, or you could be lazy and write a small job that does the trick for you. Just replace TableId with your tablenum. 1 2 3 4 5 6 7 8 9 10 11 [...]]]></description>
			<content:encoded><![CDATA[<p>When you want a list of all the mandatory field on table X, yould check all the properties on the table fields, or you could be lazy and write a small job that does the trick for you. Just replace TableId with your tablenum.</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
</pre></td><td class="code"><pre class="xpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> CheckMandatoryFieldsOnTable<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    DictTable dictTable;
    DictField dictField;
    <span style="color: #0000ff;">int</span> i;
    TableId tableId <span style="color: #00007f;">=</span> <span style="color: #0000ff;">tablenum</span><span style="color: #000000;">&#40;</span>custtable<span style="color: #000000;">&#41;</span>;
    ;
    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>;
    <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>dictTable.<span style="color: #000000;">fieldCnt</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>
        dictField <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> DictField<span style="color: #000000;">&#40;</span>tableId<span style="color: #00007f;">,</span> dictTable.<span style="color: #000000;">fieldCnt2Id</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>dictField.<span style="color: #000000;">mandatory</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            info<span style="color: #000000;">&#40;</span>dictField.<span style="color: #000000;">name</span><span style="color: #000000;">&#40;</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>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/list-of-mandatory-fields-on-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving DB-objects to other layers &#8230; without losing data</title>
		<link>http://www.doens.be/2010/02/moving-db-objects-to-other-layers-without-losing-data/</link>
		<comments>http://www.doens.be/2010/02/moving-db-objects-to-other-layers-without-losing-data/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 07:00:15 +0000</pubDate>
		<dc:creator>Jeroen Doens</dc:creator>
				<category><![CDATA[Dynamics AX]]></category>
		<category><![CDATA[AOT]]></category>
		<category><![CDATA[Ax 5.0 (2009)]]></category>
		<category><![CDATA[DictTable]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.doens.be/?p=307</guid>
		<description><![CDATA[Most of us have already been confronted with the problem of tables being inserted in the wrong layer, and when they already contain data it is very difficult to transfer these objects to the correct layer without losing data. I found the following article on Axaptapedia that helps you with this issue: http://www.axaptapedia.com/Move_DB_objects_to_another_layer]]></description>
			<content:encoded><![CDATA[<p>Most of us have already been confronted with the problem of tables being inserted in the wrong layer, and when they already contain data it is very difficult to transfer these objects to the correct layer without losing data.</p>
<p>I found the following article on Axaptapedia that helps you with this issue: <a href="http://www.axaptapedia.com/Move_DB_objects_to_another_layer">http://www.axaptapedia.com/Move_DB_objects_to_another_layer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doens.be/2010/02/moving-db-objects-to-other-layers-without-losing-data/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>
	</channel>
</rss>

