O'Reilly logo

Extending Microsoft Dynamics NAV 2016 Cookbook by Alexander Drogin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing collections with the FOREACH statement

The FOREACH statement, natural in C#, has been introduced in NAV 2016. It is commonly used in C# to iterate on instances of a structure with an enumerator, which is usually introduced by implementing the IEnumerable interface. In NAV 2016, you can apply the same statement to enumerable .NET objects.

How to do it...

Now we will collect a list of table fields that have relations to other tables and show them in a factbox page. Data is retrieved from object metadata in the XML format, and FOREACH comes in handy when iterating on lists of XML nodes:

  1. The page in the following recipe consists of two parts: the main page and a factbox subpage. First we will create the factbox subpage. Create a page in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required