Object Portability Tool for Dynamics NAV

Content

The NAV object mover is a program that will help you renumber and downgrade your NAV objects. Given a renumber definition file it can move objects to new locations in your NAV database. It works on text exports of NAV objects. Other features of the program can downgrade the format of your object export file. That will enable you to import objects designed in new NAV version into older NAV databases. The following is a full list of the program features.

  • Renumber objects.
  • Downgrade objects.
  • Remove timestamps from objects.
  • Replace strings.

Renumber Objects

The main purpose of this tool is to allow NAV developers to move objects from one number range to another. In order to renumber the objects the tool needs a map file, which contains information about the new numbers of the objects you want to move. Below you can see a sample of an object map.

[Object Map] 
Field75400.2=777 
Codeunit75400=55401 
Codeunit75401=55400 
Codeunit75402=55402 
Form75401=65401 
Form75402=65402 
MenuSuite54=56 
Report75401=85401 
Report75402=85402 
Report75403=85403 
Table75400=95400 
Table75401=95401 
Table75402=95402 
Table75403=95403

As shown in the sample map it is possible to renumber tables, fields, reports, forms, code units, data ports, and menu suites. The format of the file is like a standard ini file. Each line in the file represents a mapping of an object. One of the lines above contains the text "Form75401=65401", which will map the form object 75401 to a new object number 65401.

Based on an export of text objects from NAV the tool can create a one to one map of all objects defined and referenced in the export file. The command line below shows you how.

NAVMOVE action=CreateMap input=object_input_file map=map_output_file

Once the file specified by the map parameter is created then you can edit it and specify the new numbers for the objects that you want to renumber. It might be a good idea to save the changed map file as a new file name. This ensures that you don’t overwrite it by accidently running the tool again with the same settings. With the new map file you can call the tool again with the Move action to apply the rules in the map to text file with the NAV objects.

NAVMOVE action=Move input=object_input_file output=object_output_file map=map_input_file

When this command has finished running then the renumbering is completed.

Downgrading Objects

Exporting NAV objects cannot always be imported in an earlier version of NAV. This tool has the capability to help overcome this problem. It can analyze a NAV object text export and find the elements that will prevent the import in a database from an earlier version of NAV. The following command line can be used to downgrade the objects.

NAVMOVE action=Downgrade input=object_input_file output=object_output_file version=target_version

Specify the target version of your downgrade. If you want to import your objects in a version 3.70 then you should specify that as the target version. Please note that NAV 2009 has the target version 6 and not 2009. Downgrading can include the removal of clustered index information. Another common thing is the removal of menu suite objects.

Removing Timestamps

Sometimes the object timestamps can create problems during the import of a text object file. This is usually the case if the user that made the export has a different Windows locale setting than the importing user. Removing the timestamps from the objects in the text file will make the import more robust to this problem. However, you will lose the information carried by the timestamp. Object versions will remain unchanged, which most of the time makes the object timestamps uninteresting. See the command line syntax below.

NAVMOVE action=RemoveTimestamps input=object_input_file output=object_output_file

Search and Replace Strings

Even though most of the conversion necessary can be done using the already described program actions, it can be useful to run a general search and replace of information on the resulting object text file. There is an action named ReplaceStrings, which was built to do this. It will search for strings using regular expressions and replace the found strings with other string that you have specified. The search patterns and the replacement strings are defined in a configuration file.

A sample configuration file is shown below. It will replace all occurrences of "Country/Region Code" with "Country Code". This is a useful replacement when moving objects from 4.0 to 3.70. For some reason the standard terminology has changed between these versions. There may be many other terminology changes like this.

[Regular Expressions] 
CountryRegionCode:Pattern=Country/Region Code 
CountryRegionCode:Replace=Country Code

The next example will find all references to a BMP file and remove the directory part of the file path. This leaves only the file name.

[Regular Expressions] 
BMP:Pattern=\bBitmap=(.*?)([^\\]*[.]bmp) 
BMP:Replace=Bitmap=$2 
BMP:IgnoreCase

The first part of the names in the configuration file is the identifier of the rule. This is what is shown before the colon. Identifiers will group the lines with the pattern, replace and additional information that make up the rule.

Describing the use of regular expressions is outside the scope of this documentation.

Installation

The tool is a standalone executable file. It can be placed anywhere on your computer and run from the command line. Just unzip the downloaded file and you are ready to go.

Project Status

This project is work in progress. It was developed for internal use and may not convert all references in your object text file.

In case you find out that something is missing or needs attention then you are very welcome to contact me at . Please include a good description of the problem and a sample object file to reproduce the problem. Also, please note your NAV version number and language.