PacktLib: Microsoft Dynamics NAV 7 Programming Cookbook

Microsoft Dynamics NAV 7 Programming Cookbook


About the Author

About the Reviewers



String, Dates, and Other Data Types


Retrieving the system date and time

Retrieving the work date

Determining the day, month, and year from a given date

Using the date formula to calculate dates

Converting a value to a formatted string

Creating an array

Creating an option variable

Converting a string to another data type

Manipulating string contents

General Development


Displaying the progress bar and data in process

Repeating code using a loop

Checking for conditions using an IF statement

Using the CASE statement to test multiple conditions

Rounding decimal values

Creating functions

Passing parameters by reference

Referencing dynamic tables and fields

Using recursion

Working with Tables, Records, and Queries


Creating a table

Adding a key to a table

Retrieving data using the FIND and GET statements

Advanced filtering

Adding a FlowField

Creating a SumIndexField

Retrieving data from FlowField and SumIndexField

Using a temporary table

Retrieving data from other companies

Using a query to extract data

Creating a query to link three tables

Working with queries in C/AL

Designing Pages


Creating a page using a wizard

Using multiple options to run the page

Applying filters on the lookup page

Updating the subform page from a parent page

Creating a FactBox page

Creating a Queue page

Creating a Role Center page

Creating a wizard page

Displaying a .NET add-in on a page

Adding a chart to the page

Report Design


Creating an RDLC report

Using multiple options to run a report

Adding custom filters to the Request Page

Setting filters when report is loaded

Creating reports to process data

Creating a link from report to page

Creating a link from report to report

Adding totals on decimal field

Adding interactive sorting on reports

Creating a matrix report

Diagnosing Code Problems


Using the debugger

Setting breakpoints

Handling runtime errors

Using About This Page and About This Report

Finding errors while using NAS

Roles and Security


Assigning a role to a user

Creating a new role

Using the FILTERGROUP function

Using security filters

Applying security filter modes

Field-level security

Assigning permission to use the About This Page function

Killing a user session

Leveraging Microsoft Office


Sending data to Microsoft Word

Managing stylesheets

Sending an e-mail from NAV through SMTP

Exporting data using the Excel Buffer

Creating data connection from Excel to NAV

Showing data in Excel using PowerPivot

Creating an InfoPath form for the NAV data

Creating charts with Visio

OS Interaction


Using HYPERLINK to open external files

Working with environmental variables

Using SHELL to run external applications

Browsing for a file

Browsing for a folder

Checking file and folder access permissions

Querying the registry

Zipping folders and files within NAV



Sharing information through XMLports

Writing to and reading from a file using the C/AL code

Creating web services

Consuming web services

Sending data through FTP

Printing a report in a PDF, Excel, and Word format

Writing your own automation using C#

Using ADO to access outside data

Working with the SQL Server


Creating a basic SQL query

Understanding SIFT

Using the SQL profiler

Displaying data from a SQL view in NAV

Identifying Blocked and Blocking sessions from SQL

Setting up a backup plan

Maintaining the transaction logfiles

NAV Server Administration


Creating a NAV Server Instance

Configuring NAS to run Job Queue

Creating a user on NAV

Changing the NAV license

Creating a new database

Testing the NAV database