Tag Archives: Tip

Tip #40 | Maximum on Promoted fields on Fasttab

Ok, I admit this is not a tip, but information I found out today and could not find anywhere in documentation.

I am upgrading one of my longer running customers to NAV2015 (eventually). So one of the tasks is to make pages for these creative forms with many fields.

I thought to be smart and save some real estate by promoting a fast tab with a lot of flags. I had 8 flags, so I expected a fasttab with 8 occurances of Yes or No.

2014-12-12_18-10-20

Instead, there are only 5 promoted fields. (Nee means No in Dutch).

So I started experimenting, searching on internet and testing in 2015, since I am making the pages in 2009R2 for a hybrid phase.

It seems that there is a limit of promoted fields on fasttabs to 5. Don’t ask me why. Must be something someone thought make sense as a decision for the entire NAV community.

So, Microsoft: Please remove this limitation, or at least make it like 10 or so.

Tip #39 | Pipe Filter with Excel | Alternative

I just looked at the video by Kerry Rosvold on how to make a pipe filter in excel. It’s awesome. You can watch it here.

Now, I have an alternative way that I have been using for the last many many years and I don’t understand why I never shared it.

Blogging it now kinda make me a smart-ass. Maybe I am that. I apologize. 😉

So this is how I do it.

You copy a few lines to excel like this:

2014-12-04_20-25-50

And in Excel you paste, and copy the number column

2014-12-04_20-27-37

And you paste/transpose and copy the results again

2014-12-04_20-29-07

Then you open a notepad, paste the rows and copy the tab character

2014-12-04_20-30-17

Then you select find/replace, paste the tab character and replace with the pipe sign

2014-12-04_20-31-31

There you have your filter.

Now you have two options. Maybe there are more.

Thanks again Kerry!

NAV 2013 R2 | Debugger Watches

I totaly love the concept of pages. They are easier to merge and upgrade and they way they render is awesome. However, they come with a few drawbacks. Some of them we already had in the classic client with forms, some are new.

One of the drawbacks is the lack of drag and drop. This was true for the classic client too.

A place in Dynamics NAV where it is very obvious what would be the value of drag and drop is the debugger. The debugger in NAV2013(R2) is designed as a page.

Like this:

Dynamics-NAV-Debugger-2013-1

In general it works pretty good. It is easier to break, toggle breakpoints and the fact that you can debug any user on the servicetier is just straigt from heaven.

But one of the things that was a 1000 times easier in the old debugger was watches. It is no longer possible to just drag and drop them.

However… I only recently found a neat trick and I figured “how is it that I did not notice this earlier”.

The AL codepart is developped as a client add-in which allows to send events to the page. One of the events is adding a watch while hovering over a variable like this:

Dynamics-NAV-Debugger-2013-2

Now take a close look at the icon

Dynamics-NAV-Debugger-2013-3

If you push the + sign the variable is added to the watchlist.

Personally I find myself pretty foolish not noticing it for more than like 2 or 3 years but hey, I might not be the only one.

Here is the event in AL:

Dynamics-NAV-Debugger-2013-4

Enjoy

Tip #27 – Using Temp tables in Arrays

Tip #27 – Using Temp tables in Arrays

I’ll be honest, I found this out by accident lately but I want to share it anyway. Since it took me almost 15 years to find, it might not be know to some others.

As many of you know, using temporary tables in Microsoft Dynamics NAV is a very powerfull feature. We can use it to buffer data, to simulate SELECT DISTINCT etc. And they are free.

Using temporary tables becomes even more powerfull when adding an array to it. Let’s see this in an example.

We’ll create a new codeunit with a variable CustTemp that has two dimensions.

So now we can use CustTemp[1] and CustTemp[2].

Let’s write some C/AL Code with this.

We create a new record using CustTemp[1]. We then try a FINDFIRST on CustTemp[2]. Let’s see what message we get.

How cool is this! The contents of the CustTemp[2] is the same as that of CustTemp[1].

So what can we do with this. Let’s add some more code.

We add a new record to CustTemp[2] and filter on this value using CustTemp[1]. Then we show the value of Name and the number of records in CustTemp[2].

What does this give?

The CustTemp[1] now has the value of the Name we insterted in CustTemp[2]. CustTemp[2] ignores the filter we used in CustTemp[1].

Ok Mark, great stuff but what can I do with this?

Microsoft uses this in at least two places in the standard Navision product.

The fist place is the UpdInvPostingBuffer() function in Codeunits 80 and 90. This temporary buffer variable has two dimensions which are used to combine a select distinct with a total of the values.

The second place is the Inventory Profile Offsetting Codeunit (99000854) in Navision Manufacturing. In this codeunit supply and demand is created in the InventoryProfile table.

 

Cheers,

/Marq

Tip #14 – Autoincrement Interaction Log Entries

Tip #14 – Autoincrement Interaction Log Entries

Interaction Log entries are a very powerfull feature of Dynamics NAV. From everywhere in NAV you can add an interaction log entry if you print a report and from withing the CRM part of NAV you can register all other interactions like emails, phonecalls, mailings etc.

Interactions can be related to a path of multiple to-do’s that can be sinchronised with Outlook.

Technicaly the interaction log entry table is clustered by an entry no. Like al Entry tables in NAV this handled manualy by C/AL code. This means that every time someone creates a new interaction log entry, the last record in the table is locked, thus isolating all transactions creating a new record.

SQL Server can also maintain the entry number for you. This is built in technilogy called Identity Insert.

To activate this feature for a NAV table change the property Auto Increment of the field.

Every table can have one field with this feature. This can be (part of) the primairy key or not.

If you enable this field you will encounter two typical issues. The first issue you will notice is that if you create a new entry the value of the autoincrement field has to be set to zero. The other issue is that if an error occurs during the transaction, the entry number will be skipped, leading to gaps in the numbering.

If the latter is not a functional issue then the first can be solved by rewriting some code. For Interaction log entries this is just two places. I will let you figure out those places yourself. Stick out tongue

The five first Design Patterns & PRS Video’s are online

Hi, my name is Mark Brummel and…

I am happy to announce that five video’s about design patterns are online now.

The first six words are how I start all the video’s. The way to make them is pretty strict.

To make it easy I’ve created a playlist on YouTube with all the video’s

These video’s are online now:

How do I Read and Understand the Posting Routines

This video explains how the general flow of data works in Microsoft Dynamics NAV and explains the difference between posting, processing and archiving. Then it explains the Test Near, Test Far, Do It, Clean Up principle and where that can be found in codeunit 80, Sales Post.

Posting Routines in Dynamics NAV

At the end of the video we look at an example posting routine written with atomic coding.

How do I Use Temporary Datasets

This is one of my favorites. This video explains how to decouple UI from table structures and how to use temporary datasets in AL code. At the end of the video we combine Queries and Temporary Datasets in a page object.

How do I Use the Transfer Custom Fields Design Pattern

This pattern is a member of the larger Hooks pattern as described by Waldo. The ideo is to establish a contract to moving fields between tables where TRANSFERFIELDS cannot be used. This pattern will make upgrading much easier.

Data Process NAV

How do I Use the Select Pattern in a Posting Routine

In Microsoft Dynamics NAV you can only send one record as a contract to a codeunit. This video describes two ways to avoid sending extra parameters using functions. One is adding extra fields to the sourcetable, the other solution is to add an attribute table, which by itsself is a Temporary Dataset

How do I Implement the Number Series Pattern

Number Series are very user friendly and easy to implement once you know the steps. This video shows that step by step. It also explains how to make Number Series cross company in a very easy way.

Have fun.

The next five will be online soon.

Tip #23 – The ‘Return’ Shortcut

Today I spent some time at a customer creating a new role center for Dynamics NAV CRM users.

One of the challenges we had was to create a My To-Do list on the Role Center that was based on the actual table. All went well until we started to test and compare to My Customers.

We could not get the double click on the lines to open the To-Do card.

So we started to ‘Find The Differences’ process. It is like playing the picture game with my kids.

Then, after trying out a few things we found this in the My Customer action properties…

Amazing isn’t it! Because return (hitting the Enter key) is the same as double clicking the line it works. [:P]

So now, let’s implement one of my favorite features.

Go to the General Ledger Entries page (20) and open the actions.

And make Navigate the default action!

So  now when I double click an entry it will Navigate.

Dear Microsoft, can you please implement this. [8-|]

Enjoy…