<?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>Dynamics NAV Integration &#187; admin</title>
	<atom:link href="http://www.dynamicsnavintegration.dk/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dynamicsnavintegration.dk</link>
	<description>A site about Dynamics NAV Integration and development</description>
	<lastBuildDate>Wed, 16 Dec 2009 22:08:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easily changing option values on a field without breaking a sweat</title>
		<link>http://www.dynamicsnavintegration.dk/easily-changing-option-values-on-a-field-without-breaking-a-sweat/</link>
		<comments>http://www.dynamicsnavintegration.dk/easily-changing-option-values-on-a-field-without-breaking-a-sweat/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 21:50:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[codeing tips]]></category>
		<category><![CDATA[dynamics nav]]></category>
		<category><![CDATA[navision]]></category>
		<category><![CDATA[option field]]></category>
		<category><![CDATA[option values]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=46</guid>
		<description><![CDATA[How many times have we built a table with option fields and then &#8211; six months later &#8211; had to insert option values between the existing option values?
After we insert a new option value, we have to find all code using the options and change the option references, because &#8211; as you know &#8211; it [...]]]></description>
			<content:encoded><![CDATA[<p>How many times have we built a table with option fields and then &#8211; six months later &#8211; had to insert option values between the existing option values?<br />
After we insert a new option value, we have to find all code using the options and change the option references, because &#8211; as you know &#8211; it is the integer value of the option that gets compiled into the object and not the Option::Value part of the field.</p>
<p>Damn.. what can we do to avoid that?<br />
The answer is pretty simple: Start using functions to return the values of the individual option values.</p>
<p><strong>Let&#8217;s say we have a simple table with a option field with three values:</strong><br />
Option1, Option50 and Option100</p>
<p style="text-align: center;"><img class="size-full wp-image-47 aligncenter" title="options" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/options.JPG" alt="options" width="401" height="339" /></p>
<p><strong>Now, create three functions on the table, called:</strong><br />
GetOption1, GetOption50 and GetOption100</p>
<p>Set each function to return an integer. We will be using these functions to return the value of a specific option.</p>
<p style="text-align: center;"><img class="size-full wp-image-48 aligncenter" title="table functions" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/table-functions.JPG" alt="table functions" width="656" height="524" /></p>
<p><strong>Now we are ready to use these new functions in our code:</strong></p>
<p style="text-align: center;"><img class="size-full wp-image-58 aligncenter" title="Getoption code" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/Getoption-code2.JPG" alt="Getoption code" width="497" height="276" /></p>
<p>It is important to use the GetOption-functions everytime and everywhere you would normally use the option value reference (the &#8220;incorrect&#8221; code).</p>
<p><strong>Now comes the part that would usually make us sweat.</strong><br />
Some person says that he wants a new option value &#8211; called Option20 &#8211; and he wants it to be placed between Option1 and Option50 (can&#8217;t argue with that <img src='http://www.dynamicsnavintegration.dk/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ))<br />
As the nice guys we are, we say &#8220;ok, I will create your option for you&#8221;, knowing we have to go through days of code to find all the places we used Option50 and Option100, because their integer-value have now changed!<br />
Well&#8230; that is no problem anymore <img src='http://www.dynamicsnavintegration.dk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  You&#8217;ve got the Option-functions to do the work.</p>
<p style="text-align: center;">Let&#8217;s insert the option value:<br />
<img class="size-full wp-image-50 aligncenter" title="add option" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/add-option.JPG" alt="add option" width="440" height="335" /></p>
<p><strong>Now let us take a look at our table functions for the option field:</strong></p>
<p style="text-align: center;"><img class="size-full wp-image-51 aligncenter" title="wrong optionvalues" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/wrong-optionvalues.JPG" alt="wrong optionvalues" width="631" height="475" /></p>
<p>As we knew it would happen. The Option20-value is now taking the place of what used to be Option50&#8217;s integer value.<br />
Well, that is ok, because we only need to update the code here in the table. And nowhere else !</p>
<p style="text-align: center;">Update your functions to look like this:<br />
<img class="size-full wp-image-52 aligncenter" title="updated functions" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/updated-functions.JPG" alt="updated functions" width="358" height="233" /></p>
<p>Now, let&#8217;s have a look at the code where we used the function:<br />
Notice how the function-call has not been changed (obviously). But the Option-value reference has been changed, just as in our function, and this would have been the case perhaps hundreds of places around the system.</p>
<p style="text-align: center;"><img class="size-full wp-image-53 aligncenter" title="code after changing values" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/code-after-changing-values.JPG" alt="code after changing values" width="839" height="373" /></p>
<p>I have started to create return-functions for option values everytime I create a new option field and/or add or update values to it.<br />
It is a relief only having to change the code one place <img src='http://www.dynamicsnavintegration.dk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/easily-changing-option-values-on-a-field-without-breaking-a-sweat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Indexing a char in a string</title>
		<link>http://www.dynamicsnavintegration.dk/indexing-a-char-in-a-string/</link>
		<comments>http://www.dynamicsnavintegration.dk/indexing-a-char-in-a-string/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 13:52:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=42</guid>
		<description><![CDATA[After working with Dynamics NAV (Navision) in five years, I can still be surprised by the small details.
I just did a new discovery that is even documented in the C/SIDE help  
I regularly use the COPYSTR function to extract substrings of a string. Even if it was only a single character that I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>After working with Dynamics NAV (Navision) in five years, I can still be surprised by the small details.<br />
I just did a new discovery that is even documented in the C/SIDE help <img src='http://www.dynamicsnavintegration.dk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I regularly use the COPYSTR function to extract substrings of a string. Even if it was only a single character that I wanted to substring.</p>
<p>When copying the charachter in position 5 &#8230; instead of using:</p>
<blockquote><p>mySubString := COPYSTR(myFullString , 5, 1);</p></blockquote>
<p>We can use:</p>
<blockquote><p>mySubString := myFullString[5];</p></blockquote>
<p>The result is the same, except from the latter where we actually extract a &#8220;char&#8221; datatype instead of a text string.<br />
There can be circumstances where you have to FORMAT the char. For example if you want to MESSAGE it.</p>
<blockquote><p>MESSAGE(myFullString[5]);</p></blockquote>
<p>This won&#8217;t work because the MESSAGE function will only display the text datatype and not the char datatype.</p>
<p>This will work:</p>
<p>MESSAGE(FORMAT(myFullString[5]));</p>
<p>No matter if we assigned mySubstring to the char index [5] or return value of the COPYSTR this (below) will of course work.<br />
There is an implicit datatype conversion from char to text when assigning mySubstring.</p>
<blockquote><p>mySubString := myFullString[5];<br />
MESSAGE(mySubstring);</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/indexing-a-char-in-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining your session environment in Dynamics NAV &#8211; Citrix vs. local</title>
		<link>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/</link>
		<comments>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 00:12:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[environment variables]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=28</guid>
		<description><![CDATA[Today I ran into a scenario where I wanted some specific code to be run when the client was started on a Citrix server and some other code to be run when the client was started on a desktop.
To determine where the client is started, we can use an automation of the subtybe Windows Scipting [...]]]></description>
			<content:encoded><![CDATA[<p>Today I ran into a scenario where I wanted some specific code to be run when the client was started on a Citrix server and some other code to be run when the client was started on a desktop.</p>
<p>To determine where the client is started, we can use an automation of the subtybe Windows Scipting Host Object Model to access the Windows Environment variables.<br />
Those of you that were around ind the good old DOS  days surely know a great deal about the environment variables. We are interested in the environment variable called SESSIONNAME, which on Citrix has a value something like &#8220;ICA&#8230;&#8230;..&#8221; and locally has the value &#8220;CONSOLE&#8221;.</p>
<p>So by requesting the content of SESSIONNAME we can determine if the client is being executed on the Citrix server.</p>
<p><strong>Here&#8217;s how:</strong></p>
<p>1. Create an automation variable, with the subtype: &#8216;Windows Script Host Object Model&#8217;.WshShell</p>
<p><img class="size-full wp-image-31  alignleft" title="Automations in Dynamics NAV" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/Automations-in-Dynamics-NAV1.JPG" alt="Automations in Dynamics NAV" width="551" height="299" /><img class="size-full wp-image-30 aligncenter" title="WSHShell" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/WSHShell.JPG" alt="WSHShell" width="369" height="317" /></p>
<p>And the code:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">IF ISCLEAR(WSHShell) THEN</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">CREATE(WSHShell);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">WSHShell.ExpandEnvironmentStrings(BSTR Src)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">CLEAR(WSHShell);</div>
<p style="text-align: center;"><img class="size-full wp-image-33 aligncenter" title="code" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/code.JPG" alt="code" width="672" height="190" /></p>
<p>Notice that we have to name the environment variable by using the prefix and suffix percent character (%).</p>
<p>Of course this is useful for many other things to, if you want to know something about the current client session.</p>
<p>You can get a full list of environment variables by opening a command prompt and typing</p>
<blockquote><p>&#8220;set&#8221;</p></blockquote>
<p>A lot of useful information exists in the environment variables. For example the name of the Program Files folder etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging Code Coverage to file in Dynamics NAV</title>
		<link>http://www.dynamicsnavintegration.dk/logging-code-coverage-to-file-in-dynamics-nav/</link>
		<comments>http://www.dynamicsnavintegration.dk/logging-code-coverage-to-file-in-dynamics-nav/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:35:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[dynamics nav development]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=11</guid>
		<description><![CDATA[This entry will be about the CODECOVERAGE feature of Dynamics NAV.
This is done in version 5.0 SP1 but works in most newer versions.
I will not cover the normal use of Code Coverage. And by normal use I mean the scenario where you (the dynamics nav developer) manually start and stop the Code Coverage and view [...]]]></description>
			<content:encoded><![CDATA[<p>This entry will be about the CODECOVERAGE feature of Dynamics NAV.<br />
This is done in version 5.0 SP1 but works in most newer versions.</p>
<p>I will not cover the normal use of Code Coverage. And by normal use I mean the scenario where you (the dynamics nav developer) manually start and stop the Code Coverage and view the code. I am sure most of you know how to handle that.</p>
<p>I recently found an new feature which I hadn&#8217;t really thought of before. And it became very useful indeed.</p>
<ol>
<li>The option to start Dynamics NAV with CODECOVERAGE enabled.</li>
<li>The option to tell Dynamics NAV to log all CODECOVERAGE to a file.</li>
<li>The option to start and stop the CODECOVERAGE from code.</li>
</ol>
<p>In a problem solving situation where you cannot reproduce an error presented to you by a user, the combination of features 2 and 3 turned out to be a great tool.<br />
Why?<br />
Because it gives me the precise code that was executed at the time the error occured at the user&#8217;s computer, and I didn&#8217;t even have to be present.<br />
He can send me the log file, and I can open it in my own Dynamics NAV client (which is also done using option 2 above).</p>
<p><strong>Here is what you do:</strong></p>
<p>1. Change the user&#8217;s shortcut, so that the client will always log CODECOVERAGE to file, when started. This is done by adding:</p>
<blockquote><p>COVERAGEFILENAME=c:\somefilename.txt</p></blockquote>
<p>&#8230;to your program shortcut.<br />
Like this:</p>
<p style="text-align: center;"><img class="size-full wp-image-17   aligncenter" title="1-code-coverage-shourtcut" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/1-code-coverage-shourtcut1.jpg" alt="1-code-coverage-shourtcut" width="455" height="489" /></p>
<p>Now the client knows that whenever CODECOVERAGE is started &#8211; manually or by code &#8211; it must log to that file.</p>
<p>If you suspect something weird is going on in&#8230;say&#8230; the Sales Order Form, you can start Code Coverage in OnInit trigger:</p>
<blockquote><p>CODECOVERAGELOG(TRUE);</p></blockquote>
<p>..and stop it in the Onclose trigger:</p>
<blockquote><p>CODECOVERAGELOG(FALSE);</p></blockquote>
<p>Always running the form with Code Coverage enabled like this will of course have some impact on the performance for that user, but when hunting a problem it can be very useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/logging-code-coverage-to-file-in-dynamics-nav/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New blogging site about technical Dynamics NAV stuff created</title>
		<link>http://www.dynamicsnavintegration.dk/new-blogging-site-about-technical-dynamics-nav-stuff-created/</link>
		<comments>http://www.dynamicsnavintegration.dk/new-blogging-site-about-technical-dynamics-nav-stuff-created/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 16:50:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[dynamics nav integration]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=6</guid>
		<description><![CDATA[Hi all, and welcome to my new blog  
I will try and focus on technical Dynamics NAV (Navision) stuff, integration, code, examples etc.
If anyone has ideas for posts please let me know. I will also be making tutorials and throw up some ideas.
]]></description>
			<content:encoded><![CDATA[<p>Hi all, and welcome to my new blog <img src='http://www.dynamicsnavintegration.dk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I will try and focus on technical Dynamics NAV (Navision) stuff, integration, code, examples etc.</p>
<p>If anyone has ideas for posts please let me know. I will also be making tutorials and throw up some ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/new-blogging-site-about-technical-dynamics-nav-stuff-created/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

