The cat, the blowfly, and the Japanese archer

The other day I was witness to something awesome. A blowfly had just entered my room and I was feeling mildly annoyed. From out of nowhere my cat came, jumped and snatched the fly from the air. My sense of awe at this feat of poetry in motion was only slightly marred by the crunching sound of said blowfly in the jaws of my cute and adorable apex predator.

It brought to mind a lecture by Alan Watts that I had been listening to a while earlier. In it he mentioned that the objective of the Zen archer is to release the arrow without thinking. The big hangup here of course is how do you purposely do something not on purpose. How do you think about not thinking?

It is like being told to be spontaneous, the ghastly results of which can be viewed on national television with jarring regularity. Anyway, for a blog supposedly about programming and other worldly ventures things have started getting far too woo-woo.

So lets bring this back to programming. Serious stuff where thinking is the norm. When we are stuck we programmers think our way out of it. Or we use Google but that is just asking their AI to think about our problem. Voracious application of our intellect will solve all our problems for us. And when we get really stuck we use the scientific method to think ourselves out of any hole.

So when stuck on a particularly difficult piece of code this is what I try. I think, I Google and I try to concentrate. And the result is a headache, time wasted and no result. I want to think up something new, I need an idea!

So let’s explore this. Alan Watts tells us that thinking hard is like straining to see an object in the distance. You frantically pull at muscles around the eyes, squinting like a madman. And it has no effect whatsoever, the eyes work best when you don’t try. Just look, your eyes will work fine. So how does it work? How do we get ideas, solve problems?

“The ultimate test is always your serenity. If you don’t have this when you start and maintain it while you’re working you’re likely to build your personal problems right into the machine itself.” Robert Pirsig.

Whether it is programming, fixing a motorcycle, or releasing an arrow, the secret is not thinking about it. And you can’t do that just like you can’t lift yourself up by your bootstraps. And if you can’t do it you might as well stop trying. And then magic happens. You give up and all of a sudden, at the weirdest time, lightning strikes. You jump from your bath running naked through the streets shouting eureka.

So cheer up. Have a coffee, have a bath. There are methods for getting out of your own way and doing more creative work. But they only work if you don’t try them.

Meanwhile my cat is lying in the sun looking smug. When she lies she lies. When she walks she walks. And when there is a blowfly she crunches.

Thanks for reading this far. If you liked this you might want to explore these sources. They helped me and were the inspiration for this blog post.

For more on Alan Watts you might try listening to this
Try reading Zen and the Art of Motorcycle Maintenance by Robert Pirsig

For some tips on getting out of your own way try listening to Josh Waitskin on the Tim Ferriss podcast
And, of course, Eureka!
Photo by Zoltan Tasi on Unsplash

Upgrade from Dynamics NAV 2016 to 2018

Last weekend it was time for me to brew up a strong coffee, clear my schedule and upgrade our Dynamics NAV database from 2016 to 2018. This was a big operation for me and many colleagues as we also upgraded to SQL2017 and Windows server 2016.

The good thing about using a new server environment was that I got to do a trial run with the production conversion. Invaluable it turned out as we found some issues that we had not had converting our Acceptance database. The mail culprit here was an old SQL index that played silly buggers on our item table. I had run into a similar issue before on another database. Removing the index fixed it.

For the Dynamics NAV upgrade I used the steps Microsoft advised in their article I found some issues though so I amended this list for my personal use. With success, I upgraded our ~800Gb database in about 4 hours with zero issues.

For the Powershell lovers among you, sorry, no fancy scripts. I work for an end-user and I don’t mind executing the steps by hand as we only upgrade once a year.

For your information, here is the full list with citations for the sources of my fixes. As always, if you have questions or improvements let me know. Enjoy and happy migrating!

Before the upgrade:

  1. Code merge. Use the scripts Waldo made
  2. Install Dynamics NAV 2018
  3. Create upgrade FOB. Don’t forget upgrade objects


  1. Backup database
    1. Auto create statistics off in SQL Database.
    2. Database recovery on simple
    3. Shrink database and files
  2. Uninstall OMA
  3. Open the database with the 2016 object designer and run a 2016 service tier for the database.
  4. Unlock all objects
  5. Build all application objects–build-server-application-objects
  6. Sync database schema–synchronize-the-tenant-database-with-the-application-database
  7. 2018 Dev license in the database
  8. Stop all service tiers
  9. Delete all objects except tables
  10. In SQL:
    1. Clear Statistics,
    2. Clear SQL tables before upgrade, delete entries in tables [Debugger Breakpoint] and [Server Instance]. Delete all locks as somehow deleting them in the object designer is not enough. See the sql script below.
    3. Check for open sessions with sp_who. Kill them if necessary.
  11. Open NAV2018 Object designer as Administrator
  12. Open the database in NAV 2018 object designer. Convert the database when prompted.
  13. Load FOB
  14. Compile all objects with met Schema Sync on later, when using rtm then clear C:\Users\<USER>\AppData\Local\Temp\Microsoft Dynamics op DY-RAS2 after compile. This is a bug in compiling reports that is fixed in CU1.
  15. Check version of new objects and make sure the upgrade objects are in the database.
  16. Connect a NAV2018 service tier
  17. Open Administration Shell as administrator on the service tier
  18. Schema sync “Sync-NAVTenant –ServerInstance <ServerInstanceName>”
  19. Data upgrade “Start-NavDataUpgrade <ServerInstanceName> -Force”
    1. Check progress with Get-NavDataUpgrade -Progress
  20. Delete the objects that need to be deleted. There are a few objects in NAV2016 that are not used in NAV2018. For us these were (might not be the same for you, due diligence advised!):
    1. Table 1305
    2. Table 1510
    3. Table 470
    4. Table 5150
    5. Table 5181
    6. Table 5371
    7. Table 5372
    8. Table 824
    9. Table 825
    10. Table 826
    11. Table 827
    12. Table 828
    13. Table 829
    14. Table 830
    15. Table 8640
    16. Table 9192
  21. Delete upgrade objects
  22. Register Clientcontrol add ins
  23. Install Extensions
  24. Update Dynamics NAV web client config
  25. SQL
    1. Turn on auto create statistics
    2. Datarecovery on full (or your preferred setting)
    3. Backup
  26. Load customer licence
  27. Do a happy dance

And here is the sql script I used to clear the necessary tables:

DELETE FROM [database].[dbo].[Server Instance]
DELETE FROM [database].[dbo].[Debugger Breakpoint]

use [database]
UPDATE [Object] SET [Locked] = 0, [Locked By] = '';

Dutch Dynamics Community presentation

It seems fitting that my first blogpost is about my first Extension.

I gave a talk about the Data Exchange Framework in Dynamics NAV on the 10th of january 2018. The focus of this talk was a business case from my employer, The Learning Network.

I would like to share my slides, the setup and the extension I developed during this presentation. The slides are in Dutch. The important bits are the images. Should you want a translation please ask.

The basic premise of my extension is that whenever a record is inserted into one of the transitory tables of the Data Exchange Frameork something can be done with the events that the insert generates. In my case I use a simple table extension on the OnAfterInsert trigger of table 1214, the Intermediate Data Import, and use that event to add records for data that the Data Exchange Framework needs to create purchase documents.

The presentation: Presentatie

The extension is on GitHub

The setup for the Data Exchange Framework is here: Setup and sample xml

More about the Dutch Dynamics Community