No, there is not a dotnet add-in, just using dotnet in C/AL.
I have made updates to this tool. Read about it here.
There is an old version of a renumbering tool on this blog. It works in the classic client but who uses the classic client any more ?
I wanted to upgrade this tool to NAV 2015 (and NAV 2013 R2). There where a few issues that I needed to handle. First; how to upload a large object file to the server, how to read through millions of lines to find what I was looking for, how to replace string in all these lines without having to wait for days.
That is what I did. One Table and One Page. The code is all in the Table, not the ideal setup but I preferred fewer objects over prettier design. On the other hand this it not that big of an object so every developer should find the way through the code in there.
I have been sharing objects on this blog and have also started to share and sell objects on Objects4NAV.com. These objects are all in the range from 50.000 to 99.999. This tool will make it so much easier to import these objects into the database. Just download the renumbering tool and manually install it into the database and use the tool from there.
A little spoiler, I just used this tool on an object file with just under four million lines and needed to renumber 116 objects. The tool completed this in two minutes and forty two seconds.
So, how does it work?
The page has only three columns. Source object type, source object id and the new destination id. If you leave the destination id blank the line will be ignored. If you need to renumber an object to a number that already exists in the database start by renumber the old object before reusing the object id.
In here we have five functions:
- Read Object Lines will populate the renumbering lines from an object file.
- Suggest IDs will look for available id by searching the license permission and will update the renumbering lines.
- Write to Excel will export the renumbering lines to an Excel worksheet.
- Read from Excel will import the same format from an Excel worksheet.
- Update Object File will apply the object changes in the renumbering lines to an object file and will save a new object file.
If you have this tool in the customer database then you can import the object file you want to add to the database, get a suggestion for new ids, export a new object file and import that one into the database. This will only take a few seconds.
Lets take a closer look at the code. Perhaps that will help you in some of your ongoing task or in the future.
The first thing that the tool does is to upload the object file to the server temporary folder. In NAV we have a function for this purpose but that one can only handle a limited amount of data. A four million lines of code will not be uploaded with the standard method so I had to create another one.
The magic word here is streaming. This code will take 4KB of data in each portion and upload to the server. It will repeat until done and I don’t think you will find a useful NAV file that will not be uploaded with this code.
Once the file is on the server the tool loads the whole file into memory.
An array of string is used to store all the object lines.
This is the starting point. From this point I can loop through all the lines and do what ever I want. However, doing that line by line will take forever so I have applied a few tricks on the way.
When the tool is loading an object file into the renumbering lines it will use the dotnet string function split to break the line into smaller bits. When the tool finds an object it will search the string array for the end of that object before continuing and can therefore skip all lines except the ones needed to build the renumbering lines.
When renumbering, instead of applying each renumbering line to every code line, the tool combines five thousand lines into one dotnet string variable and uses the dotnet function replace to update the code. After each chunk of code is updated it is downloaded from the server to the client side and written to the local file system.
Well, what are you waiting for. Download the renumbering tool and start using it today.