PacktLib: Microsoft Dynamics NAV 2009 Programming Cookbook

Microsoft Dynamics NAV 2009 Programming Cookbook

Credits

About the author

About the reviewer

Preface

Strings, Dates, and Other Data Types

Introduction

Retrieving the system date and time

Retrieving the work date

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

Converting a value to a formatted string

Creating an array

Creating an Option variable

Converting a string to another data type

Manipulating string contents

Using date formulas to calculate dates

General Development

Introduction

Repeating code using a loop

Displaying a Progress Bar

Checking for conditions using an IF statement

Using a CASE statement to test multiple conditions

Creating a function

Passing parameters by reference

Referencing dynamic tables and fields

Using recursion

Working with Tables and Records

Introduction

Creating a table

Adding a key to a table

Creating transactions to alter data

Validating data

Retrieving a single record from the database

Using advanced filtering

Retrieving data using FIND

Adding a FlowField to a table

Creating a SumIndex field

Marking records for future use

Clearing filters, keys, and values

Using temporary tables to store data

Retrieving data from another company

Merging records

Writing your own rollback routine

Designing Forms

Introduction

Obtaining input without a form

Using the Form Generation Wizard

Changing text appearance

Preventing editable lookup forms

Adding an editable field to a non-editable form

Creating a matrix form

Creating a wizard-style form

Designing a form based on a temporary table

Updating a subform from a parent form

Updating a parent form from a subform

Report Design

Introduction

Using the Report Generation Wizard

Adding custom filters to the request form

Setting filters when a report is loaded

Creating a report to process data

Displaying a check mark on a report

Dynamically showing Sections on reports

Grouping data to display totals

Adding page totals to reports

Display page X of Y

Using virtual tables to loop through data

Adding a watermark to a page

Diagnosing Code Problems

Introduction

Using the debugger

Setting breakpoints

Using Code Coverage

Handling runtime errors

Using Client Monitor to diagnose problems

Finding errors when using NAS

Implementing Try / Catch / Finally

Roles and Security

Introduction

Adding roles through the User Setup table

Creating and assigning a security role

Using FILTERGROUP to restrict data

Checking for user-assigned roles

Checking Active Directory groups

Using security filters

Field-level security

Assigning menu suites based on company

Ending an idle session

Automatically adding users to NAV

Hiding values in Zoom

Leveraging Microsoft Office

Introduction

Using the style sheet tool

Sending data to Microsoft Word

Sending an e-mail from NAV through Outlook

Exporting data using the Excel buffer

Creating a data connection from Excel to NAV

Creating an InfoPath form with NAV data

Instant messaging using Office Communicator

Creating charts with Visio

OS Interaction

Introduction

Using HYPERLINK to open external files

Working with environment 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

Integration

Introduction

Flat file exchange using dataports

Sharing information through XMLports

Manually writing to and reading from files

Creating a web service

Consuming web services

Sending data through FTP

Printing reports to PDF

Creating a custom NAS handler

Writing your own automation using C#

Using ADO to access outside data

Working with SQL Server

Introduction

Creating a basic SQL query

Adding the xp_ stored procedures

Understanding SIFT tables

Using SQL Profiler

Displaying data from a SQL view in NAV

Figuring out who is blocking whom

Setting up a backup plan

Scheduling NAV tasks from SQL Server

The RoleTailored Client

Introduction

Creating a page using the Page Generation Wizard

Building a Role Center

Changing default filter columns

Building the report layout

Interactive sorting for reports

Displaying a graph on a report

Displaying a .NET add-in on a page

Index