Sep 22

Yet another…! 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.

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:

  • Compare current database name with live database name, to identify live database
  • Show custom version tag
  • Show warning for modified objects

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:

Table 2000000010 Database File (for Native database server), the available fields in this table are:

For the SQL server option, you will be looking at:

Table 2000000048 Database, the available fields are:

To get information about your current database (SQL) you could use this code:

Database.SETRANGE("My Database",TRUE);

Using the value Database.”Database Name” 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:

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.

The code for the version tag is like this:

FindVersion() : Code[250]
CheckSum := 0;
Object.SETFILTER("Version List",'*' + VersionID + '*');

NextVersionNo := '';

IF Object.FIND('-') THEN
 VersionPos := GetVersionPos(Object."Version List");
 IF VersionPos <> 0 THEN BEGIN
 Version := COPYSTR(Object."Version List",VersionPos + STRLEN(VersionID));
 IF STRPOS(Version,',') <> 0 THEN
 Version := COPYSTR(Version,1,STRPOS(Version,',') - 1);
 CheckSum := CheckSum + CS;
 IF Version > NextVersionNo THEN
 NextVersionNo := Version;
 UNTIL Object.NEXT = 0;

GetVersionPos(VersionList : Text[1024]) ReturnValue : Integer
i := -1;
 i += 1;
 ReturnValue := STRPOS(VersionList,VersionID + FORMAT(i));
UNTIL (ReturnValue > 0) OR (i = 9);
IF ReturnValue > 1 THEN BEGIN
 i := -1;
 i += 1;
 ReturnValue := STRPOS(VersionList,',' + VersionID + FORMAT(i));
 UNTIL (ReturnValue > 0) OR (i = 9);
 IF ReturnValue > 1 THEN
 ReturnValue += 1;

and the code for the modified objects are as simple as:

ModifiedObjectsExist() : Boolean

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.

On the forms OnOpen() this code sets the controls visibility:

Form - OnOpenForm()
VersionID := "Custom Version Tag";
DBFile.SETRANGE("My Database",TRUE);

CurrForm.TESTDB.VISIBLE(DBFile."Database Name" <> "Live Database Name");
CurrForm.LIVEDB.VISIBLE(DBFile."Database Name" = "Live Database Name");
FindVersion2 := FindVersion;


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:


Enjoy! And not to forget kudos to these other sites for inspiration: Waldo’s blog and Gaspodes Brain Dump.


7 Responses to “Yet another Dynamics NAV Splash Screen – YADNSS!”

  1. Slawek says:

    Instead of using Table 2000000010 Database File or Table 2000000048 Database you could use CONTEXTURL variable to identify your current server and your current database…

    Simpler (in my opinion), faster (most likely doesn’t matter in one-off run on startup), server-type independent…

    • SNielsen says:

      Thanks for mentioning it Slawek. CONTEXTURL is a small often overseen function :). Only reason for me using the virtual tables, is that often the CONTEXTURL could be showing you an IP address or a hostname alias depending on your setup (at least that is my understanding!)

      But again it is just a matter of temper what you prefer. Looking up in a virtual table, or parsing your way through the CONTEXTURL string.

    • SNielsen says:

      Also it seems the CONTEXTURL is not supported in RTC according to the NAV 2009 online help.

  2. Slawek says:

    I am not surprised, frankly speaking. RTC does not support many useful features.

    I am not a fan of RTC, in my humble opinion it is step in wrong direction. Of course Microsoft does a lot to convince everyone that it is a revolution, but I personally cannot see anything superior in RTC. Anything what couldn’t be achieved in Classic Client, even now. Classic Client required really little more development to make NAV far more superior product.

  3. waldo says:

    nice one (and thanks for the reference)…

    I won’t go into the RTC-discussion .. I’m a fan! :-).

    We created an add-in in the RTC to do just the same. It looks exactly the same, but on a RoleCenter.

    Only disadvantage is you have to install the addin, but this can be taken care of by the ComponentHelper.

    Soren, nice to meet your colleague! Hope he was happy with the demo?

Leave a Reply

preload preload preload