{"id":515,"date":"2010-09-22T19:51:19","date_gmt":"2010-09-23T02:51:19","guid":{"rendered":"http:\/\/45.63.48.66\/?p=515"},"modified":"2019-05-02T14:54:27","modified_gmt":"2019-05-02T21:54:27","slug":"yet-another-dynamics-nav-splash-screen-yadnss","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2010\/09\/yet-another-dynamics-nav-splash-screen-yadnss\/","title":{"rendered":"Yet another Dynamics NAV Splash Screen \u2013 YADNSS!"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-612\" title=\"splash\" src=\"\/wp-content\/uploads\/2010\/09\/splash.jpg\" alt=\"\" width=\"231\" height=\"218\">Yet another&#8230;! As a regular Dynamics NAV blog reader i am sure you have seen this before, in various flavors, but here is a simple yet powerful splash screen. The main purpose of this splash screen, has been to easily identify development, test and live database configurations, and also show information about the current object version in the database.<\/p>\n<p>Download the object from the download section, and see this quick tutorial on how to check for various parameters used in the splash screen, such as:<\/p>\n<ul>\n<li>Compare current database name with live database name, to identify live database<\/li>\n<li>Show custom version tag<\/li>\n<li>Show warning for modified objects<\/li>\n<\/ul>\n<p><!--more-->Depending on your database server, SQL or native there are different virtual tables we need to look at in order to determine the database name. Lets quickly explore the tables you can use for this purpose:<\/p>\n<p>Table 2000000010 Database File (for Native database server), the available fields in this table are:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-601 alignnone\" title=\"databasefile\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/09\/databasefile.png\" alt=\"\" width=\"344\" height=\"304\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/databasefile.png 344w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/databasefile-300x265.png 300w\" sizes=\"auto, (max-width: 344px) 100vw, 344px\" \/><\/p>\n<p>For the SQL server option, you will be looking at:<\/p>\n<p>Table 2000000048 Database, the available fields are:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-602\" title=\"database\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/09\/database.png\" alt=\"\" width=\"344\" height=\"204\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/database.png 344w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/database-300x177.png 300w\" sizes=\"auto, (max-width: 344px) 100vw, 344px\" \/><\/p>\n<p>To get information about your current database (SQL) you could use this code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDatabase.SETRANGE(&quot;My Database&quot;,TRUE);\nDatabase.FINDFIRST;\n<\/pre>\n<p>Using the value Database.&#8221;Database Name&#8221; to compare with a stored value that holds the name of your live database, you can conditionally display\/hide controls on the splash screen, like this example:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-605\" title=\"splashlive\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/09\/splashlive.png\" alt=\"\" width=\"303\" height=\"302\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashlive.png 303w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashlive-150x150.png 150w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashlive-300x300.png 300w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/> &#8211; <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-606\" title=\"splashtest\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/09\/splashtest.png\" alt=\"\" width=\"303\" height=\"302\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashtest.png 303w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashtest-150x150.png 150w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/09\/splashtest-300x300.png 300w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/><\/p>\n<p>Also there is code for displaying the current custom version list, and a title bar to warn if there are modified objects in the database.<\/p>\n<p>The code for the version tag is like this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nFindVersion() : Code&#x5B;250]\nCheckSum := 0;\nObject.RESET;\nObject.SETRANGE(Type,Object.Type::Table,Object.Type::MenuSuite);\nObject.SETFILTER(&quot;Version List&quot;,'*' + VersionID + '*');\n\nNextVersionNo := '';\n\nIF Object.FIND('-') THEN\nREPEAT\nVersionPos := GetVersionPos(Object.&quot;Version List&quot;);\nIF VersionPos &amp;lt;&amp;gt; 0 THEN BEGIN\nVersion := COPYSTR(Object.&quot;Version List&quot;,VersionPos + STRLEN(VersionID));\nIF STRPOS(Version,',') &amp;lt;&amp;gt; 0 THEN\nVersion := COPYSTR(Version,1,STRPOS(Version,',') - 1);\nEVALUATE(CS,DELCHR(Version,'=',DELCHR(Version,'=','0123456789')));\nCheckSum := CheckSum + CS;\nIF Version &amp;gt; NextVersionNo THEN\nNextVersionNo := Version;\nEND;\nUNTIL Object.NEXT = 0;\nEXIT((NextVersionNo));\n\nGetVersionPos(VersionList : Text&#x5B;1024]) ReturnValue : Integer\ni := -1;\nREPEAT\ni += 1;\nReturnValue := STRPOS(VersionList,VersionID + FORMAT(i));\nUNTIL (ReturnValue &amp;gt; 0) OR (i = 9);\nIF ReturnValue &amp;gt; 1 THEN BEGIN\ni := -1;\nREPEAT\ni += 1;\nReturnValue := STRPOS(VersionList,',' + VersionID + FORMAT(i));\nUNTIL (ReturnValue &amp;gt; 0) OR (i = 9);\nIF ReturnValue &amp;gt; 1 THEN\nReturnValue += 1;\nEND;<\/pre>\n<p>and the code for the modified objects are as simple as:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nModifiedObjectsExist() : Boolean\nObject.SETRANGE(Modified,TRUE);\nEXIT(Object.FINDFIRST);<\/pre>\n<p>To make it look nice, you can choose a neutral background, that has the same color as the Dynamics NAV background. The fields to compare with are stored in the company information setup table. So when you backup\/restore the database into a testserver\/database, the forms will automatically change from live to test, as it compares the database name. Of course this can be extended in multiple ways.<\/p>\n<p>On the forms OnOpen() this code sets the controls visibility:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nForm - OnOpenForm()\nGET;\nVersionID := &quot;Custom Version Tag&quot;;\nDBFile.SETRANGE(&quot;My Database&quot;,TRUE);\nDBFile.FINDFIRST;\n\nCurrForm.TESTDB.VISIBLE(DBFile.&quot;Database Name&quot; &amp;lt;&amp;gt; &quot;Live Database Name&quot;);\nCurrForm.LIVEDB.VISIBLE(DBFile.&quot;Database Name&quot; = &quot;Live Database Name&quot;);\nCurrForm.ModifiedObjects.VISIBLE(ModifiedObjectsExist);\nFindVersion2 := FindVersion;\n\nCompInfo.GET;\nCompInfo.CALCFIELDS(Picture);<\/pre>\n<p>As the functionality for startup forms have been taken out of the User Setup table, you would have to recreate this functionality, or create something similar in order to get the splashscreen displayed. This can all be done in codeunit 1 in CompanyOpen() function with a something as simple as this single line of code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">FORM.RUNMODAL(FORM::&quot;DB Splash&quot;);<\/pre>\n<p>Enjoy! And not to forget kudos to these other sites for inspiration: <a href=\"http:\/\/dynamicsuser.net\/blogs\/waldo\/archive\/2008\/05\/01\/which-database-are-you-logged-into.aspx\">Waldo&#8217;s blog<\/a> and Gaspodes Brain Dump.<\/p>\n<p>[dm]11[\/dm]<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Yet another&#8230;! As a regular Dynamics NAV blog reader i am sure you have seen this before, in various flavors, but here is a simple yet powerful splash screen. The main purpose of this splash screen, has been to easily identify development, test and live database configurations, and also show information about the current object [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[56,3],"tags":[37,77,38,27,7,39,42,35],"class_list":["post-515","post","type-post","status-publish","format-standard","hentry","category-basic-cal","category-navision","tag-application","tag-navision","tag-guide","tag-how-to","tag-objects","tag-programming","tag-splash","tag-system-table"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=515"}],"version-history":[{"count":20,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/515\/revisions"}],"predecessor-version":[{"id":1035,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/515\/revisions\/1035"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}