On Friday a new update of the new development environment for NAV arrived. A number of new features are described here and the in-client designer improvements are really nice but what most caught my attention was the first release of a tool to convert traditional C/AL code to the new AL code. Let’s see what it can already do.
My first try was with an object already in the database of the preview Azure image and unsurprisingly that worked fine. I then went on to try with one of our custom objects in our number range. For whatever reason I thought it needed to compile and therefore removed all references to non-Cronus objects to make sure it compiled in the preview image and that also worked fine. But then I thought that because the new environment is completely text-based it possibly didn’t even need the objects to be compilable. And indeed, they don’t! So here is what I did:
As the documentation in the blog post mentioned above might not work directly for you, here are the commands I used after the well-known initial export and import:
mkdir source mkdir target "c:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\finsql.exe" Command=ExportToNewSyntax, File=source\exportedObjects.txt, Database="Demo Database NAV (10-0)", ServerName=.\NAVDEMO ,Filter=Type=codeunit;ID=5010307 "c:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\txt2al.exe" source target -rename code target
Or see the result here1:
I also noticed something I didn’t see in previous releases: All variables and methods have reference counts. To test how this works I converted another object to AL which I knew referenced a number of methods of my first object. Obviously both have a lot of compilation errors as they depend on a lot of other custom objects but I can already show all references similar to the “Peek definition” feature.
Thanks to awesome Visual Studio Code we finally have a “where used” functionality directly in the code editor!2 I know there are a couple of solutions like Prism or OMA out there offering such functionality but from my point of view this is an absolute must-have for a professional editor and you shouldn’t need to buy additional tooling for something like this.
There are a number of other things worth mentioning like the speed of conversion or the speed of compilation. I really like the way this is progressing and very much look forward to using this on a day to day basis.