Dynamics NAV 2013 | Dimensions (II)

This blog post is brought forward from my old blog to be linked into my new book.


Continued from Dynamics NAV 2013 | Dimensions (I)

Dimension Sets

So how does this Dimension Set thingy work.

Let’s say you have two dimensions A and B. Dimension A has values Green and Blue and dimension B has values Black and White

This means the following possible combinations

1 Green Black
2 Green White
3 Blue Black
4 Blue White

Each combination gets a number. These combinations are stored in the new Dimension Set Entry (480). This table does not Always contain all combinations. If we add Red as value for A, the combinations get added only as they are used.

Now all we have to do at document and journal level is create a table releation with this combination table.

Since this is a 1:n relationship, one combination relates to many documents and journals we can do this with a field in the table rather than the n:1 relationship between the document table and the document dimension table in the previous version.

As we are used to in NAV, this has an implicit “Design Pattern”. The fieldnumber that relates to the dimension set is Always field 480 Dimension Set ID and it Always contains the same code.


The coding is done in two places. First is creating the journal and document data, the second is moving the data during posting/archiving.

Creating the data is slightly more difficult, but since we can use code cloning it is not hard to implement.


Each table with a Dimension Set ID has this function. It was also there in the previous version but now it is changes. Let’s have a look at it.


TableID[1] := Type1;

No[1] := No1;

“Shortcut Dimension 1 Code” := ”;

“Shortcut Dimension 2 Code” := ”;

OldDimSetID := “Dimension Set ID”;

“Dimension Set ID” :=

DimMgt.GetDefaultDimID(TableID,No,SourceCodeSetup.Sales,”Shortcut Dimension 1 Code”,”Shortcut Dimension 2 Code”,0,0);

We see in this code that the Dimension Set ID is calculated in codeunit Dimension Management (408). The magic that is done here wil be explained in a later post. Point here it that we just have to copy (clone) the code to make it work.


Since the data in the database is now normalised, we can no longer have a form or page that simply shows the data from the database. This has to be programmed. This is also included in the Dimension library.

“Dimension Set ID” :=


“Dimension Set ID”,STRSUBSTNO(‘%1 %2’,”Document Type”,”No.”),

“Shortcut Dimension 1 Code”,”Shortcut Dimension 2 Code”);

All the magic is done inside the library and all we need to do is call this function. NAV will handle the hard stuff.

The page it runs (480 Edit Dimension Set Entries) uses a buffer table and the SourceTableTemporary property that I’ve expained in other blogs.

Shortcut/Global Dimensions

A frequently asked question is: “What about global dimensions, are they still there?” or “Can I filter on dimensions?”. This has not changed in any way.


So what about posting? This is where it get’s really cool.

Remember in previous versions we used to write this code



TempDocDim.SETRANGE(“Table ID”,DATABASE::”Sales Line”);

TempDocDim.SETRANGE(“Line No.”,SalesLine.”Line No.”);



First moving the data into a buffer table, then moving to another buffer table which then is a parameter to the posting routine, where again it is moved from the buffer table to the destination table. Are you still with me?

This is the code in NAV 2013:

ResJnlLine.”Dimension Set ID” := SalesLine.”Dimension Set ID”;


The complete buffer thingy is gone and no more ugly parameters to the posting routines. The only thing we need to do is move the Dimension Set ID from one table to the other table.

It’s F*cking briljant.

Design Pattern

This uses a Design Pattern that decouples the UI from the Table. Something we have discussed within PRS a couple of times. I expect more to see of this Design Pattern in the future and it opens a new way of thinking in Dynamics NAV.

Dynamics NAV 2013 | Dimensions (I)

This blog post is brought forward from my old blog to be linked into my new book.


Ok, let’s go back to what matters. The cool stuff about NAV 2013.

At NavTechDays Antwerp I did a deep dive into the changes that are made in Dimensions. In the comming blogs I am going to share this.

What are dimensions

Dimensions are first introduced in version 3 as a replacement for project and department codes and have two main functional purposes. The first is restriction checks on posting. We can for example give a G/L account a mandatory product dimension or vice versa block a certain dimension or dimension value for posting. The second purpose of dimensions is data analysis. Using dimensions allows us to define analysis views that we can use for reporting and analysis.

The main elements in Dimensions are Master Data, Journal and Document registration, posting and analysis.

Problems & Challenges

Let’s look at the problems and challenges we have with Dimensions and the reasons for the redesigned in NAV7.

Storage Firstly we have the storage issue. Dimensions can consume up to 33% of the space in a database.

Performance Moving the data through the database takes a cut out of the performance. This is at least 30 % even if you don’t use dimensions.

Coding I think many developers here agree, to take dimensions into account when posting a journal or document you need quite a substantial piece of coding.

Design Pattern

Let’s compare the design pattern in NAV 6 or earlier and NAV 7.

If we look at the first part, master data, we can see that there are almost no changes in the masterdata part of dimensions. A special one in this list is the Job Task Line dimensions. Microsoft considers this table master data, also because you can assign multiple dimensions.

The biggest change is in the way dimensions are assigned to journals in documents. All the tables that are designed for this in previous versions have been replaced by one new table Dimension Set Entry. In this table NAV stores all used dimension combinations. Rather than storing all separate dimensions for each record, each record is assigned to a unique set combination.

This allows us to do what I personally consider the nicest change in this new architecture, to move the dimensions through the posting routines, all you need to do is assign the correct Dimension Set ID.

To analyse the data, codeunit 410 has been changed. This codeunit has always been a bottleneck in Dynamics NAV for performance reasons. In Dynamics NAV 7 this is based on the new query object.

Dimension Sets

The Dimension Set is the biggest change in NAV 7.

Each table that contains dimension information should contain a new field Dimension Set ID. In the core product this is always field 480.

Calculating the SET ID is done in codeunit 408.

This codeunit is also been on a huge diet. Because there is no longer need for the data moving functions 50% of this codeunit has been removed. Perhaps even more because the new code for the Set handling has been added.

Each table should have a new function for showing the dimensions. This is done using the dimension set entry table as a temporary table.

— To Be Continued —

ANNOUNCING: New Book | Learning Dynamics NAV Patterns

Since Packt Publishing put it on their website, I might as well reveal a secret project I’ve been working on for the last couple of months, almost a year.

My new book Learning Dynamics NAV Patterns is about to be released. I am in the final stages of processing reviews.

You can order the book here.

The book is a written version of the Master Class for Application Architecture and Patterns I am currently teaching across the globe and contains a lot of information about the Dynamics NAV DNA in a structured, easy to follow way. Things that have been in the product, some 30 years, some only one or two releases.

It also contains coding best practices, anti-patterns and refactoring methodologies and finaly a real world example of how to apply patterns while architecting a solution, working with Delta files and using Visual Studio Online to host your IP in the cloud.

The book is a more abstract and technical version of my first book Microsoft Dynamics NAV 2013 Application Design. All the things I learned from being part of the Design Patterns project and Partner Ready Software have been applied to this hands on bundled work. I would like to thank all other members from the teams for their inspiration during the meetings and brainstorm sessions and I hope they enjoy the way the efforts are combined and for everyone to grab although the book is my view and solely my opinion on the matter. The book would have also been worse without the reviewers. One in particular who shall remain anonimous had a big impact on the final version.

I’ve also read countless articles about clean code, object orriented programming and design patterns. I can’t mention them all but I would like to thank everyone for sharing their views and vision with the world.

Please (pre) order the book and enjoy.

Marije Brummel


NAV 2015 | Import FOB, back to MS-DOS?

Although I understand the investments in Multi-Tenancy from a Microsoft perspective it does not always make our live easier.

Today during the import of a Fob at a customer I am upgrading to NAV2015 I got this message.


I don’t even run a Multi-Tenant system. This means I have to start PowerShell and run this command.

Although I love the power of PowerShell, I hate using it. Why isn’t this available from the development environment?

This case was getting even more strange since the error PowerShell gave was on a table that was not affected by the fob. The Object name already exists. I could only solve the issue with changing the tablename.

Where is the simplicity in that.

Sorry for my rant, but maybe this post helps someone having the same issue.

Tip #51 – Scrolling Development Environment in Windows 10

If you install Windows 10 RTM and Dynamics NAV 2015 development environment you will notice that the scrolling on the development environment with your mouse wheel does not work.

Scrolling in Windows 10-1

I was pointed to this by the NAV Yammer group and found it hard to believe since I’ve been testing with Windows 10 for a while.

This is a bug and will be fixed by Microsoft.

Fortunately Mibuso has the answer.


It seems to be a setting in Windows 10

Go To: Settings – Device – Mouse & Touchpad – Turn Off “Scroll inactive windows when I hover over them”

Scrolling in Windows 10

Thanks massicm!