<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Small Square Services » NAV Development</title>
	
	<link>http://smallsquareservices.com</link>
	<description>Every Small Detail, Squared Away</description>
	<lastBuildDate>Mon, 05 Mar 2012 13:43:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SmallSquareServicesNAVDevelopment" /><feedburner:info uri="smallsquareservicesnavdevelopment" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Cultured Differences</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/JPmLtyrmgOM/</link>
		<comments>http://smallsquareservices.com/2011/10/cultured-differences/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 21:44:42 +0000</pubDate>
		<dc:creator>Andrew Smith</dc:creator>
				<category><![CDATA[Featured Posts]]></category>
		<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Newbie]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=436</guid>
		<description><![CDATA[Last week we discussed how to apply standard formatting codes for currencies and dates to Microsoft Dynamics NAV 2009 RTC reports. As I mentioned in that blog post, there are...]]></description>
			<content:encoded><![CDATA[<p>Last week we discussed <a href="http://smallsquareservices.com/2011/09/the-formatted-numbers-game/">how to apply standard formatting codes for currencies and dates</a> to Microsoft Dynamics NAV 2009 RTC reports.  As I mentioned in that blog post, there are some hoops we have to jump through in order to show more than one culture&#8217;s formats on the same report.  In the typical report the localization information is contained in the report header and it will only include a single localization.  Fortunately Microsoft includes its globalization standards as a .NET DLL that we can add as an assembly to a report.</p>
<h1>The Setup</h1>
<p>For this example we are going to use the standard report &#8220;Customer Account Details&#8221; as a base report (renumbered so we don&#8217;t overwrite anybody&#8217;s default report).  This report already has the option to show customer account details in the customer&#8217;s own currency, however it does not include the region specific currency formatting except for the number of decimal places.  For kicks, and because it provides a better example, we are also going to take the dates and format those to the localized short date format.  Note that this latter customization is one that might cause confusion if used in an actual client environment, especially if you have a particularly diverse set of customer regions being reported on with a single report.</p>
<p>It is worth mentioning that this example does not make any changes to the behavior of the classic version of this report except to add some hidden data fields for the RTC to use.  To the best of my (admittedly newbie) knowledge, formatting of this type is not possible using the classic version without creating a complex function to apply the formatting prior to outputting the data to the report.</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif11.png" alt="" /></p>
<h1>The Hoops</h1>
<h2>First Hoop – Letting your report use external assemblies</h2>
<p>If you look at the <a href="http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx">MSDN page regarding currency formatting codes</a> you will see that references are made to a <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx">&#8220;CultureInfo&#8221;</a> object.  Yet if you try to define such an object or make use of one per the VB examples shown, you will get an error.  This is because we have to add the assembly for it.  Before we can do that though, we need to edit the report properties to tell the report to allow external assemblies.  Load up the report in classic, put the cursor on a blank line and hit ALT+F4 to bring up the report properties.  Once you have that up, set the &#8220;EnableExternalAssemblies&#8221; option to &#8220;Yes&#8221;.</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif21.png" alt="" /></p>
<p>If you forget this step then later on you will see an error about &#8216;not a trusted assembly&#8217; that looks a lot like this:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif31.png" alt="When you don't enable external assemblies:  An error occurred during local processing.  The report references the code module [code] which is not a trusted assembly." width="869" height="146" /></p>
<h2>Second Hoop – Adding the assembly to the RTC version of the report</h2>
<p>Once you have external assemblies enabled, the next step is to actually add that assembly to the report so that we can call upon the CultureInfo object within in.</p>
<p>To do this you have to load up the report designer (using the &#8220;View | Layout&#8221; menu option) and right click on the top left corner of the report in the report designer and select properties:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif41.png" alt="" /></p>
<p>In the properties dialog, click on the &#8220;References&#8221; tab.  Click on the ellipses to bring up the list of modules, click on the &#8220;.NET&#8221; tab and locate &#8220;sysglobl&#8221;:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif51.png" alt="" /></p>
<p><em>Note: If you&#8217;ve not used sysglobl before, you may have to use the Browse tab the first time.  Browse to your local Microsoft.NET folder and locate a &#8220;sysglobl.dll&#8221; in the relevant Framework folder.</em></p>
<p>Once you have added the globalization assembly, it should appear in the list as shown below:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif61.png" alt="" /></p>
<p>Next we have to add in some code to let us make use of the CultureInfo object.</p>
<h2>Third Hoop – Creating functions to use the format codes with the globalization object</h2>
<p>In a future blog post we will discuss some of the interesting ways to use the ability to add code to the report.  For now though, we just want to create two custom functions that will let us format dates and currencies to a specific localization.  As we did in Fig 4., above, we are going to right click the top left corner of the report and select properties.  This time, instead of going to the &#8220;References&#8221; tab we are going to go to the &#8220;Code&#8221; tab.</p>
<p>Inside the code tab, we will define two functions:</p>
<p style="margin-left: 36pt;"><strong>FormatCurr (ByVal Amount as Decimal, ByVal Precision as Integer, ByVal Region as Integer, ByVal BlankNegZero as Boolean)<br />
</strong></p>
<p style="margin-left: 36pt;"><strong>FormatDate (ByVal TransDate as Date, ByVal Region as Integer)</strong></p>
<p>The first function will take the decimal amount to be formatted, the number of digits of precision (which we will pass in from the Currency.&#8221;Amount Decimal Places&#8221; setting), the Windows integer region code (taken from Language.&#8221;Windows Language ID&#8221;), and whether or not to return blanks for zero or negative values.  For the second function we do not need to worry about rounding precision on a date so we just pass in the date in question and the Windows integer region code.</p>
<p>The code itself is very simple VB .NET code:</p>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">Public Function FormatCurr(ByVal Amount As Decimal, ByVal Precision as Integer, ByVal Region as Integer,
</span></pre>
<pre style="margin-left: 108pt;"><span style="font-family: Courier New; font-size: 8pt;"> ByVal BlankNegZero as Boolean)
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   Dim TempString as String
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   if (Amount &lt;= 0 and BlankNegZero) then
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">     return ""
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   end if
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   TempString = "C" + Precision.ToString
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   Return Amount.ToString(TempString, New Globalization.CultureInfo(Region, False))
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">End Function
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">Public Function FormatDate(ByVal TransDate As Date, ByVal Region as Integer)
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">   Return TransDate.ToString("d", New Globalization.CultureInfo(Region, False))
</span></pre>
<pre style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">End Function
</span></pre>
<p>Now all we have to do is add some data to the classic version of the report and adjust some of the RTC fields and we will be done.</p>
<h1>Making the customization</h1>
<p>In the classic version of the report, we now have to add decimal precision and the Windows language ID as hidden fields.  The decimal precision we can look up and pass from the Currency table (ID 4), the Windows language ID we will first have to do a lookup on the customer&#8217;s language in the Customer table (ID 18) and use that language code to make a lookup into the Language table (ID 8 ) for the Windows language ID.</p>
<p>Both of these lookups make the most sense to do in the Customer – OnAfterGetRecord of the classic report (the .fob of the report is included at the bottom of this post, search on &#8220;<em>SSS ABS</em>&#8221; in that module to find the relevant modifications).</p>
<p>We will add the data in hidden text boxes in the section designer in the Customer, Body (8) section.</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif71.png" alt="" /></p>
<p>Once we have those fields added we can then go to Visual Studio and make changes to the expression for the currency fields.  It is worth mentioning that I have left most of the original function intact, such that the report will print with the existing default formatting if the &#8220;Print Amounts in Customer&#8217;s Currency&#8221; option is left unchecked.  Some of the expressions are thus greatly expanded.</p>
<p>For example, the original expression for a debit amount is as follows:</p>
<p style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">=Code.BlankNegAndZero(Fields!AmountToPrint.Value)<br />
</span></p>
<p>And the modified version is shown below (with spacing added for readability):</p>
<p style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">=iif(<span style="color: blue;">NOT</span> Fields!PrintAmountsInLocal.Value,<br />
</span></p>
<p style="margin-left: 62pt;"><span style="font-family: Courier New; font-size: 8pt;">Code.BlankNegAndZero(Fields!AmountToPrint.Value), </span></p>
<p style="margin-left: 62pt;"><span style="font-family: Courier New; font-size: 8pt;">Code.FormatCurr(Fields!AmountToPrint.Value,Fields!CurrPrecision.Value, Fields!LanguageID.Value,<span style="color: blue;">TRUE</span>))<br />
</span></p>
<p>The last step before we are ready to roll is to look at the formatting of the table cells.  While the classic version of the data is likely going to follow currency conventions, it will not include any special currency symbols that can help make it obvious what currency we are looking at.  If the user selects not to show local currency we should retain the original formatting, but if they do use the culture specific formatting, then our FormatCurr and FormatDate functions will handle that instead of the Format property.  For the same cell as used in the above sample for the expression of the debit amount, the &#8220;Format&#8221; field of the cell that originally reads:</p>
<p style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">=Fields!AmountToPrintFormat.Value<br />
</span></p>
<p>Will be modified to this:</p>
<p style="margin-left: 36pt;"><span style="font-family: Courier New; font-size: 8pt;">=iif(Fields!PrintAmountsInLocal.Value, nothing, Fields!AmountToPrintFormat.Value)<br />
</span></p>
<h2>Results</h2>
<p>We can now look at the output and see what looks different when we show amounts in local date and currency and not in local date and currency and compare that with the base version of the report.</p>
<p>I am running the standard USA Cronus database filtering only on customers 01445544 (USD), 32656565 (Euro) and 42147258 (Czech koruna).  The base version of the report will display as follows with the option to show amounts in customer currency:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif81.png" alt="" /></p>
<p>The modified version now displays with region specific date and currency formatting:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/10/100411_2144_CulturedDif9.png" alt="" /></p>
<h1>Conclusion</h1>
<p>If you have an international client that does want some multiple region-specific formatting on the same report or even formatting for a single region that is not the client&#8217;s installed region, this method will do the trick.  The code functions are also easy enough to copy and paste into a new report, which means that once you jump through the hoops of letting the report use the <em>sysglobl</em> assembly, it is pretty easy to do again on another report.</p>
<p><a href="http://smallsquareservices.com/wp-content/uploads/2011/10/CustAcctDetailMCF1.zip">Download Modified Customer Account Detail Report</a></p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/JPmLtyrmgOM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/10/cultured-differences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/10/cultured-differences/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cultured-differences</feedburner:origLink></item>
		<item>
		<title>The (Formatted) Numbers Game</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/sv3HEsIiWAU/</link>
		<comments>http://smallsquareservices.com/2011/09/the-formatted-numbers-game/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 02:25:27 +0000</pubDate>
		<dc:creator>Andrew Smith</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Newbie]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=421</guid>
		<description><![CDATA[Microsoft Dynamics NAV 2009 RTC report design using RDLC has a lot of flexibility when formatting dates, times, and numbers. While you can create custom number formatting (which we will...]]></description>
			<content:encoded><![CDATA[<p>Microsoft Dynamics NAV 2009 RTC report design using RDLC has a lot of flexibility when formatting dates, times, and numbers.  While you can create custom number formatting (which we will cover in a future blog post) many of the standard formatting options will often do the trick far more easily and without requiring the developer to worry about localization differences.</p>
<p>For a full list of the formatting options, the MSDN site has a handy reference page for both <a href="http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx">numbers</a> and <a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx">dates/datetimes/times</a>.   I will not be covering all of the various formatting options in my example due to the fact that there are so many of them, but the most commonly used ones are represented.</p>
<h2>Cautions</h2>
<p>The RDLC formatting options typically will use your default localization info for formatting.  If you are a USA developer working for a French client you may need to change your current locale in order to see the formatting options as your client will see them.  One of the nice things about the standard formatting options vs. the custom formatting strings is that they will take care of this change for you without you having to write a lick of code and without you having to define multiple formatting strings for each locale you service.</p>
<p>It bears mentioning that if you need to include multiple different locale formats in a single report there are some hoops to jump through to get that to work properly.  We will cover that subject in a blog post very soon.  Suffice it to say that it will not work to do multiple locales with just the standard formatting options.</p>
<h2>How To</h2>
<p>Create your report data items in classic as you normally would.  Our example report skips some of the good design steps for localization and multi-language in favor of simplicity.  The entire report is just several different type data items in a single section:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/09/092311_0225_TheFormatte1.png" alt="" /></p>
<p>Once you fire up RDLC and place your data item in the desired location you will want to look at the properties, specifically the &#8220;Format&#8221; property:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/09/092311_0225_TheFormatte2.png" alt="" /></p>
<p>In the example above, I am formatting a decimal value to the locale default currency format (denoted by the &#8220;C&#8221;).  Since I have my locale set to the USA, it will print in $#,###.00 format:  Leading USD dollar sign, comma group separator, period decimal place designator and two decimal place precision.  As I mentioned previously, if I send this report off to a French client I will not have to redo the report to print properly in Franc or Euro, the localized default format for currency will automatically handle that for me (Note: This does not convert the amount, only changes the format).</p>
<p>If, for some reason, I have to call a <span style="font-family: Courier New; font-size: 10pt;">Code.SomeFunction</span> to do some special processing and want to return the formatted text from that function it is worth noting that you can use these standard formatting codes in the VB.Net <span style="font-family: Courier New; font-size: 10pt;">Format</span> function call like so:</p>
<p style="padding-left: 30px;"><span style="font-family: Courier New; font-size: 10pt;">Public Function SomeFunction(ByVal Value As Decimal)<br />
</span></p>
<p style="padding-left: 30px;"><span style="font-family: Courier New; font-size: 10pt;"> &#8230;processing code here&#8230;<br />
</span></p>
<p style="padding-left: 30px;"><span style="font-family: Courier New; font-size: 10pt;"> Return Format(Value,&#8221;C&#8221;)<br />
</span></p>
<p style="padding-left: 30px;"><span style="font-family: Courier New; font-size: 10pt;">End Function<br />
</span></p>
<p>&nbsp;</p>
<p>See the <a href="http://smallsquareservices.com/wp-content/uploads/2011/09/formatsample.zip">attached sample report</a> and <a href="http://smallsquareservices.com/wp-content/uploads/2011/09/FormatSample.pdf">PDF printout</a> of the report that shows the most commonly used codes for more information.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/sv3HEsIiWAU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/09/the-formatted-numbers-game/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/09/the-formatted-numbers-game/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-formatted-numbers-game</feedburner:origLink></item>
		<item>
		<title>When to take the blue pill – Matrix for newbies</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/v_2PowyFqi4/</link>
		<comments>http://smallsquareservices.com/2011/09/when-to-take-the-blue-pill-%e2%80%93-matrix-for-newbies/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 14:36:52 +0000</pubDate>
		<dc:creator>Andrew Smith</dc:creator>
				<category><![CDATA[Featured Posts]]></category>
		<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Newbie]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=388</guid>
		<description><![CDATA[When not to use a Matrix control In Microsoft Dynamics NAV 2009 RTC Report Design, matrixes can provide a lot of easy functionality for a newbie report writer who wants...]]></description>
			<content:encoded><![CDATA[<h1>When not to use a Matrix control</h1>
<p><span style="font-family: Times New Roman;font-size: 12pt">In Microsoft Dynamics NAV 2009 RTC Report Design, matrixes can provide a lot of easy functionality for a newbie report writer who wants to collate a lot of data without doing a lot of work. With that in mind, there are some significant drawbacks to using a matrix if your report has certain hoops to jump through that often mean that it may be easier to use a table. Note that while advanced NAV report designers can likely get around some of these obstacles by employing some of the less intuitive tricks available, this article is intended for novice users looking at whether or not a matrix control would be faster and easier to implement than the more traditional table control.</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt"><br />
</span></p>
<h2>The what and how of building a matrix report</h2>
<p><span style="font-family: Times New Roman;font-size: 12pt"> If you are not already familiar with what a matrix control is, the easiest explanation is that it is a way to bring the versatility of a spreadsheet <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Pivot_table">pivot table</a> to a report. The joy of working with pivot tables is that you can essentially take a mass dump of data and then organize it however you like and the pivot table logic takes care of the collating and summation without you having to write a lick of code. It bears mentioning that if you&#8217;re doing a onetime-only report that requires this sort of processing, you may actually be better off creating a dummy report that simply outputs all your uncollated data and then use the &#8220;About this report&#8221; feature to <a href="http://smallsquareservices.com/2011/09/viewing-report-data/">dump it into Excel and use an Excel PivotTable to have your way with it</a>. Excel in that particular case is, in my opinion, far more versatile and flexible for the neophyte than trying to figure out a matrix.<br />
</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt">For the novice, I do strongly recommend reading up on Small Square Services&#8217; own <a href="http://smallsquareservices.com/2011/05/matrix-intro/">introductory &#8220;how to&#8221; for setting up a matrix</a>. If you are like me and you like to have points of comparison so that you can see how multiple authors approach matrixes I can also recommend <a href="https://blogs.msdn.com/b/nav-reporting/archive/2009/08/28/building-a-matrix-report-in-microsoft-dynamics-nav-2009-sp1.aspx">Claus Lundstrøm&#8217;s tutorial</a> on the MSDN blog.</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt"><br />
</span></p>
<h2>Why use a matrix?</h2>
<p><span style="font-family: Times New Roman;font-size: 12pt">While the focus of this post is to show when not to use a matrix, it&#8217;s important to understand why you would want to use one in the first place. Simply put, matrixes are easy to make. You don&#8217;t have to process, sort or collate data &#8211; all you have to do is create a simple classic report layout that contains all the data you need and then put a matrix control with the proper groups on a page. For many folks that don&#8217;t favor writing a lot of processing code, this is certainly an appealing notion, especially as you can define much of the look, feel, and content through the visual designer interface. If you want fancy processing but do not want to spend a lot of time on it, a matrix can be a &#8220;dream come true&#8221; control in the Visual Studio Report Designer.<br />
</span></p>
<h2>So why the blue pill?</h2>
<p><span style="font-family: Times New Roman;font-size: 12pt">If a matrix is so powerful, why not use one all the time? What are some of the features of a report that would cause a newbie report designer to bang their head against the nearest solid object?<br />
</span></p>
<h3>Non-uniform output</h3>
<p><span style="font-family: Times New Roman;font-size: 12pt">One of the great things about matrixes is that they collate data and create <strong>dynamic</strong> rows and columns to display that output. When something is created at run time, it greatly limits our ability to modify how that data is shown, if some of the data is to be singled out for special treatment. You can do some very useful things with the expression based attributes of matrix cells but if you have anything in a matrix that needs to have different data (as opposed to different appearance) in certain columns, then a matrix is going to likely not be the best solution. An example would be if you want to provide monthly totals with quarterly totals and averages. Trying to add those averages into a mix of totals is possible to do, but you&#8217;ll have to employ some more advanced tricks. If that&#8217;s what you want to do, tables are probably going to be easier in the long run than trying to squeeze this square peg into a round hole. It is worth mentioning that the very snazzy looking <a href="https://blogs.msdn.com/b/robertbruckner/archive/2009/03/05/tablix-the-matrix-revolution.aspx">Tablix</a>* control will eventually remove this concern, allowing us to mix matrixes with tables with impunity.<br />
</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt">This reason is likely the most important one of the three I list here. It is possible to spend a lot of time wrestling with the matrix control to try to get it to insert an &#8220;average&#8221; column after the main body but before the totals. Or if you have three columns per reporting item but your totals only make sense for two of those columns and you want to eliminate or hide the third.<br />
</span></p>
<h3>Summation columns that are not simple totals</h3>
<p><span style="font-family: Times New Roman;font-size: 12pt">Matrixes provide very handy &#8220;subtotal&#8221; columns that you can add for any column or row grouping. If all you want are subtotals across a data slice, then this is just another marvelous feature of matrixes. If, however, you want totals for some of the data and averages for some of the data, then you&#8217;ve essentially got to provide code to the InScope function that will dynamically do one or the other, which likely exceeds the newbie threshold.<br />
</span></p>
<h3>Your data is not repetitive or does not need to be collated</h3>
<p><span style="font-family: Times New Roman;font-size: 12pt">Matrixes are primarily a tool for collating repetitive data. If your data is relatively flat and/or doesn&#8217;t feature repeating categories, then a table with groups is probably going to offer more flexibility with less hassle than a matrix.<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Times New Roman;font-size: 12pt">Matrix is a very powerful control, and learning how to use it will be key for great Report Design in Microsoft Dynamics NAV 2009, but always make sure to think if it&#8217;s the <em>right</em> powerful tool for the job.</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt"><br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Times New Roman;font-size: 12pt"><em>*RDL 2005 is used in Microsoft Dynamics NAV 2009 for the RTC Report Designer. RDL 2008 has more powerful options for controls (such as the Tablix control), grouping, and various other improvements.  Hopefully the next major release of Microsoft Dynamics NAV will feature the RDL 2008 improvements.</em></span></p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/v_2PowyFqi4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/09/when-to-take-the-blue-pill-%e2%80%93-matrix-for-newbies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/09/when-to-take-the-blue-pill-%e2%80%93-matrix-for-newbies/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=when-to-take-the-blue-pill-%25e2%2580%2593-matrix-for-newbies</feedburner:origLink></item>
		<item>
		<title>Can You Be Shown What The Matrix Is?</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/MWY5bhtXXUM/</link>
		<comments>http://smallsquareservices.com/2011/05/matrix-intro/#comments</comments>
		<pubDate>Tue, 10 May 2011 14:00:46 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[Featured Posts]]></category>
		<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Classic vs RTC]]></category>
		<category><![CDATA[Customer]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Formatting]]></category>
		<category><![CDATA[Item]]></category>
		<category><![CDATA[Matrix]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Subtotal]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=316</guid>
		<description><![CDATA[Take the right color pill with this post about the Matrix control in the RTC Report and how it can help you. But, this topic is not for the novice,...]]></description>
			<content:encoded><![CDATA[<p>Take the right color pill with this post about the Matrix control in the RTC Report and how it can help you.  But, this topic is not for the novice, so make sure you buckle up.</p>
<p>In this post, we&#8217;ll talk about how to bring together diverse data into a dynamic table – we&#8217;ll use some Item Sales data for customers by month, which has always been a pest to accomplish in the Classic Report Sections.  We&#8217;ll be going over:</p>
<ul>
<li>How to setup the raw data for the RTC</li>
<li>Creating the basic Matrix</li>
<li>The basic idea of Row and Column Grouping</li>
<li>Controlling Visibility</li>
<li>Introduction to Totals</li>
<li>Cleaning Up</li>
</ul>
<p>This one topic will probably spawn a host of follow-up posts to explain parts, or expand on other possibilities.  I even considered having this post broken out into the 5 parts above because it&#8217;s a lot of ground to cover.</p>
<h1>How to setup the raw data in Classic</h1>
<p>Firstly, we&#8217;ll need to bring together all the data requested:</p>
<ul>
<li>Customer Info</li>
<li>Item Info</li>
<li>Sales Invoice Info</li>
<li>Month info (yes, this is key)</li>
</ul>
<p class="notetext">Note: You may want to review our RTC vs Classic data structure post <a href="http://smallsquareservices.com/2011/05/understanding-classic-vs-rtc-report-data/">here</a>.</p>
<p>We&#8217;ll start out with a data structure like so:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho1.png" alt="" /></p>
<ol>
<li>Setup your filter request fields on them as appropriate.</li>
<li>None have a DataItemLink linkage to each other.</li>
<li>On the Date DataItem, we&#8217;ll set the DataItemTableView to limit the results to Months and ask the user for a Period Start filter.</li>
<li>On the Sales Invoice Line, we&#8217;ll set the DataItemTableView to limit the results to Type=ITEM.  On the Sales Invoice Line, we&#8217;ll want to manually handle our filtering in OnPreDataItem, like so:</li>
</ol>
<p>&nbsp;</p>
<pre><code>SETRANGE("No.",Item."No.");
SETRANGE("Sell-to Customer No.",Customer."No.");
SETRANGE("Posting Date",MonthLoop."Period Start",MonthLoop."Period End");
</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="notetext"><em>Note:  This assumes all data is version 2009+ data.  The Sales Invoice Line table got the Posting Date field in version 2009, so if your customer has older data, you&#8217;ll either want to populate the Sales Invoice Line <strong>Posting Date</strong> field with the header data or you&#8217;ll have to have a Sales Invoice Header item.</em></p>
<p>You&#8217;ll then want to setup the Sections to display these elements, like so:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho2.png" alt="" /></p>
<p>Make sure to set easy to follow <strong>DataSetFieldName</strong> properties on each.   Notice how MonthLoop has both the &#8220;Period Name&#8221; (aka Month Name in our case) and the &#8220;DATE2DMY(&#8220;Period Start&#8221;,3)&#8221; function (Year integer).  If your customer wants to run the report over the course of multiple years, you&#8217;ll need that Year value to differentiate one January from another.</p>
<p>Once you have all the data you&#8217;ll want, make sure to save the report, then <strong>Create Layout Suggestion</strong>.</p>
<p class="notetext"><em>Note: Consider adding the standard Page Headers here so Suggest Layout takes care of them for you. Our example plans to go to Excel, so no headers/footers are required.</em></p>
<h1>Create the Basic Matrix</h1>
<p>Once you see your suggested layout, you&#8217;ll wonder why we had you do that.  Not sure why, but something happens in that sequence that links the DataSet to things behind the scenes.  Without that step, we have not been able to get a Matrix to work correctly.</p>
<p>Go ahead and delete the unhelpful table:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho3.png" alt="" /></p>
<p>Now, let&#8217;s create a Matrix in the space we have.   On the Toolbox item to the far left, pick a matrix and drag it onto the Body:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho4.png" alt="" /></p>
<p>You should get an empty matrix:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho5.png" alt="" /></p>
<p>Not much to look at, so let&#8217;s add some content.</p>
<h1>The Basic Idea of Row and Column Grouping</h1>
<p>So, let&#8217;s review what we need to accomplish:  We need Item Sales Quantity and Sales Amount by Customer and Item by Month and by Year.  Hopefully you see how that equates out to 2 row groups (Customers and Items) and 2 column groups (Year and Month), with somehow 2 columns of data inside each.</p>
<p>With both the Row and Column Groups, we always get one of each to start with, so we&#8217;ll focus on adding/setting the Row Groups first.</p>
<h2>Customer and Item Rows</h2>
<p>Right-click on the Rows box and select <strong>Insert Group</strong>.  You&#8217;ll be asked to set the properties of the new group:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho6.png" alt="" /></p>
<p>Go ahead and change the name part RowGroup2 to ItemGroup for clarity.  In the <strong>Group On</strong>, <strong>Expression</strong> area, click in the first row.  You&#8217;ll be able to select from the Fields:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho7.png" alt="" /></p>
<p>Select your Item Number field from the list (your field names may vary based on how you set the DataSetFieldNames).</p>
<p class="notetext"><em>Note: If you don&#8217;t see these fields, close up the Designer, close NAV, reopen NAV, reopen the report, delete the Layout, and redo Create Layout Suggestion.<br />
</em></p>
<p>That&#8217;s all we&#8217;ll set on this for now, though we&#8217;ll be back.  Click OK.  You should still see the &#8216;Rows&#8217; field as blank, but a new column added:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho8.png" alt="" /></p>
<p>Adding the Customer Group:</p>
<ol>
<li>Right-click the field that is marked <strong>(1)</strong> in the picture above and select <strong>Edit Group</strong>.</li>
<li>Change RowGroup1 to CustomerGroup for clarity.</li>
<li>Set the Group On Expression to Customer No.</li>
<li>Click OK.</li>
<li>You&#8217;ll see the exact same thing as above.   In this case, we&#8217;ll need to also set the Value property manually to the correct field:</li>
</ol>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho9.png" alt="" /></p>
<h2>Adding the Year and Month Columns</h2>
<p>A very similar process is used here.  We&#8217;ll Insert a Column Group for Month, then set the existing Column Group to Year.  No pictures, just quickly stepping through:</p>
<ol>
<li>Right click on the Columns block and select Insert Group.</li>
<li>Setup ColumnGroup2 as MonthGroup based on the Month Name as the Group On Expression</li>
<li>Right click on the Columns block again and Edit Group.</li>
<li>Setup ColumnGroup1 as YearGroup based on the Year Integer as the Group On Expression</li>
<li>Set the Value property of the Year Group to the Year Integer</li>
</ol>
<h2>Adding the Quantity and Amount Data Fields</h2>
<p>On the Data field, right click and select Add Column.  That will split the single cell into four, like so:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho10.png" alt="" /></p>
<p class="notetext"><em>Note: It&#8217;s critical that those blank cells are below the Column Group headers.  If not, delete the Matrix and start over.</em></p>
<p>Now you can drag and drop the Fields from the Result list on the left to populate the bottom two empty fields (it&#8217;ll auto-caption):</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho11.png" alt="" /></p>
<p class="notetext"><em>Note: This approach does not bring over the Multi-Language Captions from NAV to try to keep this overview short.  Bear in mind your customer needs for multi-language support before you implement exactly as outlined.</em></p>
<p class="notetext"><em>Note: This walkthrough also does not address properly formatting fields using the Format DataSet items, so make sure to bear that in mind as well.</em></p>
<p>You can go ahead and save it as is, and give it a run to see how it looks, it technically works now:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho12.png" alt="" /></p>
<p>You can see it automatically took care of grouping our Customers and Items by Month and Year, with some data.</p>
<h1>Controlling Visibility</h1>
<p>Obviously, Items that weren&#8217;t sold to a given customer are adding a lot of blank space we don&#8217;t need.  Thankfully, we don&#8217;t have to write any C/AL to SKIP records, we can control the Visibility of Group Rows.</p>
<ol>
<li>Open the report up in the Designer</li>
<li>Right click on the Item No field we setup before and Edit Group</li>
<li>Let&#8217;s look over the <strong>Visibility</strong> tab:</li>
</ol>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho13.png" alt="" /></p>
<p>Change the <strong>Initial Visibility</strong> to <strong>Expression</strong>.  In my case, the expression will simply be:</p>
<p>&nbsp;</p>
<pre><code>=Sum(Fields!SaleAmount.Value) = 0
</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This may be a trifle confusing.   While it&#8217;s talking about if it should be visible, it&#8217;s setting the <strong>Hidden</strong> property.  In my case, if the Group&#8217;s SUM of SaleAmount is zero, then Hidden is TRUE.</p>
<p>The same Visibility property can be set for any Row or Column Group.   I&#8217;ll set it to my Customer Group as well, but not my Month/Year columns, as the customer wants them to show regardless.</p>
<h1>Introduction to Totals</h1>
<p>The customer wants there to be subtotals per Customer, a grand total per month, subtotals per year per item, and pretty much everything that can be totaled.  Not a problem.</p>
<p>For each Row or Column Group that requires Totals, simply right-click on the relevant group field and select <strong>Subtotal</strong>:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho20.png" alt="" /></p>
<p>In our case, we&#8217;ll turn them on for everything:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho14.png" alt="" /></p>
<p>Those grey spaces will be automatically populated by the totals.  Let&#8217;s break down what totals are which:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho15.png" alt="" /></p>
<ol>
<li>This will be at the very bottom, a grand total, with totals per month/year across ALL Customers and ALL Items</li>
<li>This will be at the bottom of each Customer, with subtotals per month/year across ALL Items</li>
<li>This will be at the far right, a grand total, with totals per Customer and per Item for ALL months and years run</li>
<li>This will be at the right of each Year, with subtotals per Customer and per Item for ALL months for that year</li>
</ol>
<p>Any or all of those can be powerful data elements to be able to include with two clicks each.  You will want to update the Captions for each, likely, so users understand the data they&#8217;re totaling.</p>
<h1>Cleaning Up</h1>
<p>There are many things we can do from here to tidy up.  I&#8217;ll list several of them, and then review a couple of them:</p>
<ol>
<li>If this were going to be printed, add header/footer data</li>
<li>Resize the columns to better fit the data</li>
<li>Align the Column Headers to make more sense</li>
<li>Add the Customer Name and Item descriptions to the Rows</li>
<li>Apply Border Grids to the whole matrix</li>
<li>Apply special formatting to Total Rows/Columns/Fields to better differentiate</li>
</ol>
<h2>Add Name/Descriptions to Number Fields</h2>
<p>This one is super easy, but not intuitive if you&#8217;re used to C/AL.</p>
<p>Select the Customer No. textbox, then under the <strong>Properties</strong> panel, select the <strong>Value</strong> drop-down and double-click <strong>Expression</strong>:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho16.png" alt="" /></p>
<p>You can easily use this screen to select additional fields.  After the existing expression text, add:</p>
<p>&nbsp;</p>
<pre><code>+ ": " +
</code></pre>
<p>&nbsp;</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho17.png" alt="" /></p>
<p>Double-clicking on your Customer name under Fields will insert the right coding for it.</p>
<p class="notetext"><em>Note: As you become more comfortable with the Designer, you do not need to open the Expression builder to enter these things, you can just type them right into Value.<br />
</em></p>
<h2>Add Borders to the Matrix</h2>
<ul>
<li>Click on the large empty cell in the Upper Left.</li>
<li>Hold down <strong>Ctrl</strong> on your keyboard and select all the other fields.  You can&#8217;t select the grey space, it will assume you mean the whole matrix control.</li>
<li>Change the property <strong>BorderStyle</strong> from None to <strong>Solid</strong>.</li>
</ul>
<h2>Add Special Formatting to Total Data</h2>
<p>If you have already charged ahead and set the Total fields to Bold, you&#8217;ll have noticed that the labels were made bold, but the data was not.</p>
<p>You have to click on the little green arrow in the corner of the Total field to set formatting special on the auto-generated cells:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho18.png" alt="" /></p>
<p>When you have done that selection correctly, you will see the <strong>Properties</strong> panel set to the <strong>Subtotal</strong> control instead of a <strong>textbox</strong>:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050811_1812_CanYouBeSho19.png" alt="" /></p>
<p>You can setup separate Borders and Font settings for the generate total cells.   For example, you may want a <strong>BorderStyle</strong> <strong>Top</strong> set to Solid, a <strong>BorderWidth Top</strong> set to <strong>2pt</strong>, and <strong>FontWeight</strong> set to <strong>Bold</strong>.  This will great a strong visual cue that it&#8217;s a total row.</p>
<p>&nbsp;</p>
<p>Download the text object <a href="http://smallsquareservices.com/downloads/examples/SmallSquareServices-matrix-intro.txt">here</a>.</p>
<p>&nbsp;</p>
<p>In closing, there&#8217;s always more you could do with a report like this, but hopefully we&#8217;ve whet your appetite for Matrix reports.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/MWY5bhtXXUM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/05/matrix-intro/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/05/matrix-intro/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=matrix-intro</feedburner:origLink></item>
		<item>
		<title>Understanding Classic vs RTC Report Data</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/0ekLaXl-c3s/</link>
		<comments>http://smallsquareservices.com/2011/05/understanding-classic-vs-rtc-report-data/#comments</comments>
		<pubDate>Mon, 09 May 2011 20:58:54 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Classic vs RTC]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Report]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=332</guid>
		<description><![CDATA[The Classic reporting engine and the RTC reporting engine are two very different animals. Hopefully, we can highlight the differences today for some of the deeper topics we&#8217;ll cover this...]]></description>
			<content:encoded><![CDATA[<p>The Classic reporting engine and the RTC reporting engine are two very different animals.  Hopefully, we can highlight the differences today for some of the deeper topics we&#8217;ll cover this week.
</p>
<p>Microsoft Dynamics NAV classic reports are highly iterative.  For example, this Customer/Item Statistics report is a great example:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi1.png" alt=""/>
	</p>
<p>The engine will loop through the Customers that match the user supplied filters.  For each Customer, it will go through some related set of Value Entry records (for item sales data).  This is a very clear teamwork in the results:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi2.png" alt=""/>
	</p>
<p>What is more interesting is that the RTC reporting engine does not work in a hierarchy at all.   It smashes the data flat into one giant resultset.  Header items are simply <em>repeated</em> for every row.  In our above sample report, we&#8217;d have a resulting table like so (subset to be more readable):
</p>
<div>
<table style="border-collapse:collapse" border="0">
<colgroup>
<col style="width:101px"/>
<col style="width:154px"/>
<col style="width:128px"/>
<col style="width:128px"/>
<col style="width:128px"/></colgroup>
<tbody valign="top">
<tr style="background: #4f81bd">
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid #7ba0cd 1.0pt; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none;background: #4f81bd">
<p><span style="color:white"><strong>Customer No.</strong></span></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid #7ba0cd 1.0pt; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none;background: #4f81bd">
<p><span style="color:white"><strong>Customer Name</strong></span></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid #7ba0cd 1.0pt; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none;background: #4f81bd">
<p><span style="color:white"><strong>Item No.</strong></span></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid #7ba0cd 1.0pt; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none;background: #4f81bd">
<p><span style="color:white"><strong>Item Name</strong></span></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  solid #7ba0cd 1.0pt; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt;background: #4f81bd">
<p><span style="color:white"><strong>Amount</strong></span></p>
</td>
</tr>
<tr style="background: #d3dfee">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>10000</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>The Cannon Group</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>1900-S</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>PARIS Chair</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt">
<p>1,156.80</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>10000</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>The Cannon Group</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>1928-W</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>Storage Unit</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt">
<p>2,636.00</p>
</td>
</tr>
<tr style="background: #d3dfee">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>10000</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>The Cannon Group</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>1964-S</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>TOKYO Chair</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt">
<p>964.00</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>20000</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>Selangorian</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>1900-S</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>PARIS Chair</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt">
<p>192.80</p>
</td>
</tr>
<tr style="background: #d3dfee">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid #7ba0cd 1.0pt; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>20000</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>Selangorian</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>1908-S</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  none">
<p>LONDON Chair</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #7ba0cd 1.0pt; border-right:  solid #7ba0cd 1.0pt">
<p>950.50</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>
 </p>
<p>You can see the flattened results for yourself.  Run a report in the RTC. Under the <strong>Help</strong> button, select <strong>About This Report</strong>, like so:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi3.png" alt=""/>
	</p>
<p>You <em>may</em> get a message like so:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi4.png" alt=""/>
	</p>
<p>Do as it instructs.  When you head to <strong>About This Report</strong> again, you&#8217;ll see something akin to:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi5.png" alt=""/>
	</p>
<p>That&#8217;s a giant List of all the data the report is using to produce the results.  You&#8217;ll see all sorts of things in there you may not realize would be, such as Captions, Formats, Header info.  This feature can be particularly helpful, since under the <strong>Actions</strong> menu, you can <strong>Send To -&gt; Excel</strong> all the raw data.   If you ever doubt your report&#8217;s data, you can analyze it in this way.
</p>
<p>Understanding that the data is giant and flat may help you better understand why some layouts will have things such as <strong>=First(SomeField)</strong> or <strong>=Sum(SomeField)</strong>, like so:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050911_2059_Understandi6.png" alt=""/>
	</p>
<p>It&#8217;s also a key understanding for making the most out of the RTC format&#8217;s powerful Table and Matrix controls, which we&#8217;ll go into depth on this week.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/0ekLaXl-c3s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/05/understanding-classic-vs-rtc-report-data/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/05/understanding-classic-vs-rtc-report-data/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=understanding-classic-vs-rtc-report-data</feedburner:origLink></item>
		<item>
		<title>Mystery White Space: Issue #1</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/zqFIB2_V8ug/</link>
		<comments>http://smallsquareservices.com/2011/05/mystery-white-space-issue-1/#comments</comments>
		<pubDate>Thu, 05 May 2011 20:31:43 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Report]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=283</guid>
		<description><![CDATA[We ran into a peculiar issue today &#8211; a report that kept adding extra pages for no discernible reason.  A quick check of the usual community sites didn&#8217;t yield a solution, so...]]></description>
			<content:encoded><![CDATA[<p>We ran into a peculiar issue today &#8211; a report that kept adding extra pages for no discernible reason.  A quick check of the usual community sites didn&#8217;t yield a solution, so I thought it was blog-worthy as a topic.</p>
<p>In our case, we have a report that is printing a 2<sup>nd</sup> page with nothing on it but headers.  For our example, we&#8217;ll use the Top 10 Customer report.</p>
<p>When we preview the report, it looks fine:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050511_2032_MysteryWhit1.png" alt="" /></p>
<p>Nothing unusual, looks like it would fit on our standard page size here.  Yet, if you switch from Interactive Mode to <strong>Print Layout</strong>, we get a mystery second page:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050511_2032_MysteryWhit2.png" alt="" /></p>
<p>The usual things to check are:</p>
<ul>
<li>NewPagePerRecord property</li>
<li>NewPagePerGroup property</li>
<li>Any CurrReport.NEWPAGE calls</li>
<li>Footers that might cause extra whitespace</li>
</ul>
<p>None of those are present in our report.  What&#8217;s the culprit?  White space, not to the bottom, but to the right:</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/05/050511_2032_MysteryWhit3.png" alt="" /></p>
<p>That random extra inch of space on the right that someone forgot to neaten up is being treated as printable space, which means for each page of the report, we&#8217;ll have an &#8216;extra&#8217; page to the right.  Once you close that space back down to the printable elements, it&#8217;s back to a single page.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/zqFIB2_V8ug" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/05/mystery-white-space-issue-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/05/mystery-white-space-issue-1/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mystery-white-space-issue-1</feedburner:origLink></item>
		<item>
		<title>Introducing the Newbie</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/7ocEoZysWtg/</link>
		<comments>http://smallsquareservices.com/2011/04/introducing-the-newbie/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 03:00:34 +0000</pubDate>
		<dc:creator>Andrew Smith</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Newbie]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/?p=226</guid>
		<description><![CDATA[One of the daunting issues with learning Navision is the sheer volume of knowledge that a new user is presented with in order to use and customize the system. To...]]></description>
			<content:encoded><![CDATA[<p>One of the daunting issues with learning Navision is the sheer volume of knowledge that a new user is presented with in order to use and customize the system. To paraphrase Douglas Adams:</p>
<p style="margin-left: 36pt"><em>&#8220;Navision is big. You just won&#8217;t believe how vastly, hugely, mind- bogglingly big it is. I mean, you may think it&#8217;s a long way down the road to the chemist&#8217;s, but that&#8217;s just peanuts to Navision.&#8221;<br />
</em></p>
<p>One of my goals as the newbie programmer at Small Square Services is to leave a record, a path if you will, for those that come after me to learn without getting as lost as I have sometimes become. Accordingly, I&#8217;ll be posting some of the things I&#8217;ve learned with an emphasis on a very inexperienced view of how to get around in Navision. Writing about shortcuts, insights into the underlying structure of Navision, and how to find some of the more tucked away components will be my emphasis. For those of you reading this that are already experienced NAV developers, this may not teach you much, but hopefully if you ever have to train somebody else you can point them this way to get them started.</p>
<p>It is worth noting that while the competition for newbie Navision programming blogs is sparse, I am not a pioneer in this arena. I highly recommend the <a href="http://www.navision-girl.com/">Navision Girl</a> blog for an already well populated set of articles and tutorials.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/7ocEoZysWtg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/04/introducing-the-newbie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/04/introducing-the-newbie/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=introducing-the-newbie</feedburner:origLink></item>
		<item>
		<title>Improving DropDowns</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/yfYThDEp9Lw/</link>
		<comments>http://smallsquareservices.com/2011/04/improving-dropdowns/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 16:47:20 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[DropDown]]></category>
		<category><![CDATA[Field Groups]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/2011/04/improving-dropdowns/</guid>
		<description><![CDATA[In the RTC, when you are going to enter data that refers to another table, you get a wonderful DropDown showing you extra info. For example, when entering a Vendor...]]></description>
			<content:encoded><![CDATA[<p>In the RTC, when you are going to enter data that refers to another table, you get a wonderful DropDown showing you extra info.  For example, when entering a <strong>Vendor</strong> on a <strong>Purchase Order</strong>:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/04/042711_1647_ImprovingDr1.png" alt=""/>
	</p>
<p>You can quickly see all the Vendors, with the columns for their name, address, and contact info.  As a developer, you can quickly and easily add or remove fields to this list.  In our example today, the customer doesn&#8217;t want to see the <strong>Phone No.</strong> field, but wants to see the <strong>Purchaser</strong><br />
		<strong>Code</strong>.
</p>
<p>To make this change, we&#8217;ll want to open up the <strong>Classic</strong> client and design the Vendor table.  Under the <strong>View</strong> menu, you&#8217;ll have an option called <strong>Field Groups</strong>:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/04/042711_1647_ImprovingDr2.png" alt=""/>
	</p>
<p>This will open up a new little Field Groups window:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/04/042711_1647_ImprovingDr3.png" alt=""/>
	</p>
<p>As you can guess, we can edit the Field Group <strong>DropDown</strong> to change what the DropDown will show when Vendors are involved.  (If you&#8217;re working with a new custom table, simply add a new Field Group called DropDown.  Make sure to include the primary key.)
</p>
<p>Based on our requirements, our Vendor DropDown field group now looks like:
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/04/042711_1647_ImprovingDr4.png" alt=""/>
	</p>
<p>
 </p>
<p>When we return to our Purchase Order and try to select a Vendor, we&#8217;ll see this list (you may have to adjust your column widths):
</p>
<p><img src="http://smallsquareservices.com/wp-content/uploads/2011/04/042711_1647_ImprovingDr5.png" alt=""/>
	</p>
<p>
 </p>
<p>You <em>can</em> include a FlowField like <strong>Balance</strong>, but bear in mind that the DropDown may be much slower to open due to the increased calculation load.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/yfYThDEp9Lw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/04/improving-dropdowns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/04/improving-dropdowns/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=improving-dropdowns</feedburner:origLink></item>
		<item>
		<title>C/AL Modifications and the Change Log</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/JdvafAkkbCE/</link>
		<comments>http://smallsquareservices.com/2011/04/cal-modifications-and-the-change-log/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 18:22:31 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[ChangeLog]]></category>
		<category><![CDATA[SarbanesOxley]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/2011/04/cal-modifications-and-the-change-log/</guid>
		<description><![CDATA[In our previous post about the Change Log in Microsoft Dynamics NAV, we talked about turning on monitoring of the Payment Terms Code on the Customer table. Now you&#8217;ve gotten...]]></description>
			<content:encoded><![CDATA[<p>In <a title="Introduction to the Change Log" href="http://smallsquareservices.com/2011/04/introduction-to-the-change-log/" target="_blank">our previous post</a> about the <strong>Change Log</strong> in Microsoft Dynamics NAV, we talked about turning on monitoring of the Payment Terms Code on the Customer table.</p>
<p>Now you&#8217;ve gotten another request from that client that will involve updating the Payment Terms Code on Customers when certain things happen in the system, such as they go overdue.  You&#8217;ve made the changes they&#8217;ve requested without a hitch, but two months later, they call, very disturbed, because your process doesn&#8217;t update the Change Log. What happened?   You called VALIDATE on the field, that&#8217;s all that&#8217;s needed, right?</p>
<p>Unfortunately, no.  The Change Log will automatically log all User Interface changes, but changes made in code are handled differently.  As the developer, you have the responsibility to register those changes with the Change Log yourself.</p>
<p>Your code needs to go from:</p>
<p>&nbsp;</p>
<pre><code>Customer.VALIDATE("Payment Terms Code",'COD');
Customer.MODIFY(TRUE);
</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>To:</p>
<p>&nbsp;</p>
<pre><code>xRecRef.GETTABLE(Customer);
Customer.VALIDATE("Payment Terms Code",'COD');
Customer.MODIFY(TRUE);
RecRef.GETTABLE(Customer);
ChangeLog.LogModification(RecRef,xRecRef);
</code></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>xRecRef</strong> and <strong>RecRef</strong> are both variables of type <strong>RecordRef</strong>, and <strong>ChangeLog</strong> is a <strong>Codeunit</strong> variable pointing at the <strong>Change Log Management</strong> Codeunit.</p>
<p>The other logging functions work fairly similarly:</p>
<ul>
<li>LogInsert</li>
<li>LogRename</li>
<li>LogDelete</li>
</ul>
<p>If the client turns of Change Log or stops tracking the fields you&#8217;re programming for, the Change Log Management Codeunit won&#8217;t record the changes or give the user any error message, so this code won&#8217;t become deprecated when the client changes their mind about auditing.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/JdvafAkkbCE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/04/cal-modifications-and-the-change-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/04/cal-modifications-and-the-change-log/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cal-modifications-and-the-change-log</feedburner:origLink></item>
		<item>
		<title>DateFormula Part 1: Closing Tricks</title>
		<link>http://feedproxy.google.com/~r/SmallSquareServicesNAVDevelopment/~3/h31Xn9W_gu0/</link>
		<comments>http://smallsquareservices.com/2011/04/dateformula-part-1-closing-tricks/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 19:34:59 +0000</pubDate>
		<dc:creator>Jeremy Vyska</dc:creator>
				<category><![CDATA[NAV Development]]></category>
		<category><![CDATA[NAV Usage]]></category>
		<category><![CDATA[DateFormula]]></category>

		<guid isPermaLink="false">http://smallsquareservices.com/2011/04/dateformula-part-1-closing-tricks/</guid>
		<description><![CDATA[Any time you have to enter a DateFormula, such as Payment Terms or other places where a value such as &#8220;30D&#8221; would work, there are a few easy ways you...]]></description>
			<content:encoded><![CDATA[<p>Any time you have to enter a DateFormula, such as Payment Terms or other places where a value such as &#8220;30D&#8221; would work, there are a few easy ways you can get the beginning or end of the current Year, Quarter, Month, or even week.  Simply use:</p>
<div>
<table style="border-collapse: collapse;" border="0">
<colgroup>
<col style="width: 213px;"></col>
<col style="width: 213px;"></col>
<col style="width: 213px;"></col>
</colgroup>
<tbody>
<tr style="background: #4f81bd;">
<td style="padding-left: 7px; padding-right: 7px; border-top: solid #7ba0cd 1.0pt; border-left: solid #7ba0cd 1.0pt; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><span style="color: #000000;"><strong>Period Type</strong></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid #7ba0cd 1.0pt; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><span style="color: #000000;"><strong>Beginning</strong></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid #7ba0cd 1.0pt; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: solid #7ba0cd 1.0pt;"><span style="color: #000000;"><strong>Ending</strong></span></td>
</tr>
<tr style="background: #d3dfee;">
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #7ba0cd 1.0pt; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><strong>Year</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: none;">-CY</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: solid #7ba0cd 1.0pt;">CY</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #7ba0cd 1.0pt; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><strong>Quarter</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: none;">-CQ</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: solid #7ba0cd 1.0pt;">CQ</td>
</tr>
<tr style="background: #d3dfee;">
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #7ba0cd 1.0pt; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><strong>Month</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: none;">-CM</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: solid #7ba0cd 1.0pt;">CM</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #7ba0cd 1.0pt; border-bottom: solid #7ba0cd 1.0pt; border-right: none;"><strong>Week</strong></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: none;">-CW</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #7ba0cd 1.0pt; border-right: solid #7ba0cd 1.0pt;">CW</td>
</tr>
</tbody>
</table>
</div>
<p>For users, this means if you wanted the Payments of Customers always due at the end of the current month, you&#8217;d setup a new Payment Term with a Formula of &#8216;CM&#8217;.</p>
<p>For developers, this means you can quickly get the current year into a filter like so:</p>
<p>&nbsp;</p>
<pre><code>DateRec.SETRANGE("Period Start",CALCDATE('-CY',WORKDATE),CALCDATE('CY',WORKDATE));
</code></pre>
<p>&nbsp;</p>
<p>We&#8217;ll dive into some of the stranger uses of DateFormula in a later post, including how to factor in Weekdays, or the xth day of the month/week.</p>
<p>&nbsp;</p>
<p><a style="display:none;" id="ddetlink1722431161" href="javascript:expand(document.getElementById('ddet1722431161'))">For developers, some sample code</a>
<div class="ddet_div" id="ddet1722431161"><script language="JavaScript" type="text/javascript">expand(document.getElementById('ddet1722431161'));expand(document.getElementById('ddetlink1722431161'))</script>You can test out the above examples with this object.  Save it as as text file, then import, compile, and run.</p>
<pre>OBJECT Form 80001 Closing Dates Math Example
{
  OBJECT-PROPERTIES
  {
    Date=04/20/11;
    Time=[ 3:28:41 PM];
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    Width=8000;
    Height=8000;
  }
  CONTROLS
  {
    { 1000000002;TextBox;3630 ;220  ;1700 ;440  ;CaptionML=ENU=Date Basis;
                                                 SourceExpr=MyDates[1];
                                                 OnValidate=BEGIN
                                                              Calc;
                                                            END;
                                                             }
    { 1000000003;Label  ;220  ;220  ;3300 ;440  ;ParentControl=1000000002 }
    { 1000000004;TextBox;3630 ;1100 ;1700 ;440  ;CaptionML=ENU=-CY;
                                                 SourceExpr=MyDates[2] }
    { 1000000005;Label  ;220  ;1100 ;3300 ;440  ;ParentControl=1000000004 }
    { 1000000006;TextBox;3630 ;1650 ;1700 ;440  ;CaptionML=ENU=CY;
                                                 SourceExpr=MyDates[3] }
    { 1000000007;Label  ;220  ;1650 ;3300 ;440  ;ParentControl=1000000006 }
    { 1000000008;TextBox;3630 ;2310 ;1700 ;440  ;CaptionML=ENU=-CM;
                                                 SourceExpr=MyDates[4] }
    { 1000000009;Label  ;220  ;2310 ;3300 ;440  ;ParentControl=1000000008 }
    { 1000000010;TextBox;3630 ;2860 ;1700 ;440  ;CaptionML=ENU=CM;
                                                 SourceExpr=MyDates[5] }
    { 1000000011;Label  ;220  ;2860 ;3300 ;440  ;ParentControl=1000000010 }
    { 1000000020;TextBox;3630 ;4070 ;1700 ;440  ;CaptionML=ENU=CW;
                                                 SourceExpr=MyDates[7] }
    { 1000000021;Label  ;220  ;4070 ;3300 ;440  ;ParentControl=1000000020 }
    { 1000000024;TextBox;3630 ;3520 ;1700 ;440  ;CaptionML=ENU=-CW;
                                                 SourceExpr=MyDates[6] }
    { 1000000025;Label  ;220  ;3520 ;3300 ;440  ;ParentControl=1000000024 }
  }
  CODE
  {
    VAR
      MyDates@1000000000 : ARRAY [10] OF Date;

    PROCEDURE Calc@1000000000();
    BEGIN
      MyDates[2] := CALCDATE('-CY',MyDates[1]);
      MyDates[3] := CALCDATE('CY',MyDates[1]);
      MyDates[4] := CALCDATE('-CM',MyDates[1]);
      MyDates[5] := CALCDATE('CM',MyDates[1]);
      MyDates[6] := CALCDATE('-CW',MyDates[1]);
      MyDates[7] := CALCDATE('CW',MyDates[1]);
    END;

    BEGIN
    END.
  }
}
</pre>
<p></div></p>
<p>To read the (very) technical explanation, here&#8217;s the MSDN documentation on <a href="http://msdn.microsoft.com/en-us/library/dd301368.aspx">DateFormula</a>.</p>
<img src="http://feeds.feedburner.com/~r/SmallSquareServicesNAVDevelopment/~4/h31Xn9W_gu0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://smallsquareservices.com/2011/04/dateformula-part-1-closing-tricks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://smallsquareservices.com/2011/04/dateformula-part-1-closing-tricks/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=dateformula-part-1-closing-tricks</feedburner:origLink></item>
	</channel>
</rss>

