Programming Microsoft Dynamics® NAV 2013
()
About this ebook
Microsoft Dynamics NAV 2013 is a complete and robust ERP system that is accompanied by a comprehensive set of development tools. You will learn how to master these tools and tailor Microsoft Dynamics NAV 2013 to meet your customer's specific business needs.
"Programming Microsoft Dynamics® NAV 2013" will lead you from start to finish, teaching you how to use this incredible ERP software whilst simultaneously making you a more productive developer. You'll learn how to implement your solutions, as well as evaluating, managing and appraising Dynamics NAV 2013 productions and projects.
You will be empowered with the skills and knowledge that you need to get the job done and exceed your client's expectations. Step by step, you will learn how to use NAV, master the C/AL programming language, as well as the construction and uses of each object type. Ultimately, you will be able to bring your NAV 2013 solution together with fantastic efficiency.
Hands-on development examples and additional material teach you by example and uncover the insider knowledge that only years of experience can provide, truly unleashing your productivity and potential.
ApproachWritten as a practical guide, this book will show you how to utilize Dynamics NAV 2013 to its full potential. Designed to be a comprehensive reference, it should be the perfect companion for any NAV developer, manager or consultant.
Who this book is forThis book is for experienced programmers who are either new to Microsoft Dynamics NAV or for experienced developers that want to utilize the fantastic new features of NAV 2013. Managers and consultants will also benefit from understanding NAV environments in order to build on their skills and experience during development projects.
David A. Studebaker
David Studebaker is Chief Technical Officer and a founder of Liberty Grove Software with his partner Karen Studebaker. Liberty Grove Software, a Microsoft Partner, provides development, consulting, training, and upgrade services internationally for Microsoft Dynamics NAV resellers and end user customers.David has been recognized by Microsoft as a Certified Professional for NAV in all three areas: Development, Applications, and Installation & Configuration. He has been honored by Microsoft as a Lead Certified Microsoft Trainer for NAV.David just celebrated his first half century of programming, having started programming in 1962. He has been developing in C/AL since 1996. David has been an active participant in each step of computing technology from the first solid state mainframes to today's technology, from binary assembly language coding to today's C/AL and C#.David's special achievements include his role as co-developer of the first production multi-programmed SPOOLing system in 1967. David has worked on a diverse set of software applications including manufacturing, distribution, retail, engineering, general accounting, association management, professional services billing, distribution/inventory management, freight carriage, data collection and production management, among others. Prior to co-authoring this book, David was the author of Programming Microsoft Dynamics NAV (for the Classic Client) and Programming Microsoft Dynamics NAV 2009 (for the Role Tailored Client).David has had a wide range of development, consulting, sales and management roles throughout his career. He has been partner or owner and manager of several software development businesses, while always maintaining a hands-on role as a business applications developer.David has a BS in Mechanical Engineering from Purdue University and an MBA from the University of Chicago. He has been writing for publication since he was an undergraduate. David has been a member of the Association for Computing Machinery since 1963 and was a founding officer of two local chapters of the ACM.
Related to Programming Microsoft Dynamics® NAV 2013
Related ebooks
Microsoft Dynamics AX 2012 R3 Reporting Cookbook Rating: 0 out of 5 stars0 ratingsLearning Dynamics NAV Patterns Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics GP 2013 Implementation Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics NAV 2013 Application Design Rating: 0 out of 5 stars0 ratingsSAP Business Objects SA Rating: 5 out of 5 stars5/5Microsoft Dynamics AX 2012 Reporting Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics CRM 2016 Customization - Second Edition Rating: 0 out of 5 stars0 ratingsGetting Started with Oracle Data Integrator 11g: A Hands-On Tutorial Rating: 5 out of 5 stars5/5Applied Architecture Patterns on the Microsoft Platform Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics GP 2010 Implementation Rating: 5 out of 5 stars5/5Microsoft Dynamics NAV Administration Rating: 0 out of 5 stars0 ratingsMicrosoft SQL Server 2014 Business Intelligence Development Beginner’s Guide Rating: 0 out of 5 stars0 ratingsMastering Microsoft Dynamics NAV 2016 Rating: 4 out of 5 stars4/5Building Dashboards with Microsoft Dynamics GP 2016 - Second Edition Rating: 0 out of 5 stars0 ratingsMicrosoft NAV Interview Questions: Unofficial Microsoft Navision Business Solution Certification Review Rating: 1 out of 5 stars1/5Mastering QlikView Rating: 5 out of 5 stars5/5Professional Microsoft SQL Server 2016 Reporting Services and Mobile Reports Rating: 0 out of 5 stars0 ratingsApplied Microsoft Business Intelligence Rating: 3 out of 5 stars3/5Expert Cube Development with SSAS Multidimensional Models Rating: 0 out of 5 stars0 ratingsSQL Server 2014 Development Essentials Rating: 5 out of 5 stars5/5SAP Business ONE Implementation Rating: 0 out of 5 stars0 ratingsIBM Cognos 8 Planning Rating: 0 out of 5 stars0 ratingsLearn SAP BI in 24 Hours Rating: 3 out of 5 stars3/5Microsoft Dynamics AX Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsGetting Started with Dynamics NAV 2013 Application Development Rating: 0 out of 5 stars0 ratingsMicrosoft Azure SQL Data Warehouse A Complete Guide Rating: 1 out of 5 stars1/5Extending Microsoft Dynamics AX 2012 Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics 365 Third Edition Rating: 0 out of 5 stars0 ratingsOneDrive Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsSQL Server Management Studio Second Edition Rating: 1 out of 5 stars1/5
Enterprise Applications For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/53D Concrete Printing Technology: Construction and Building Applications Rating: 0 out of 5 stars0 ratingsCreating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Excel 2019 Bible Rating: 4 out of 5 stars4/5Excel Formulas and Functions 2020: Excel Academy, #1 Rating: 4 out of 5 stars4/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsAccess 2019 For Dummies Rating: 0 out of 5 stars0 ratings101 Ready-to-Use Excel Formulas Rating: 4 out of 5 stars4/5The New Email Revolution: Save Time, Make Money, and Write Emails People Actually Want to Read! Rating: 5 out of 5 stars5/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5QuickBooks 2024 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsThe Ridiculously Simple Guide to Google Docs: A Practical Guide to Cloud-Based Word Processing Rating: 0 out of 5 stars0 ratingsLearn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsExcel Tips and Tricks Rating: 0 out of 5 stars0 ratingsCreate Income through Self-Publishing: An Author's Approach on Generating Wealth by Self-Publishing Rating: 5 out of 5 stars5/5Scrivener For Dummies Rating: 4 out of 5 stars4/5Mastering QuickBooks 2020: The ultimate guide to bookkeeping and QuickBooks Online Rating: 0 out of 5 stars0 ratingsQuickBooks 2023 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsBitcoin For Dummies Rating: 4 out of 5 stars4/5QuickBooks Online For Dummies Rating: 0 out of 5 stars0 ratingsExcel 2016 For Dummies Rating: 4 out of 5 stars4/5Systems Thinking: Managing Chaos and Complexity: A Platform for Designing Business Architecture Rating: 4 out of 5 stars4/5Enterprise AI For Dummies Rating: 3 out of 5 stars3/5
Reviews for Programming Microsoft Dynamics® NAV 2013
0 ratings0 reviews
Book preview
Programming Microsoft Dynamics® NAV 2013 - David A. Studebaker
Table of Contents
Programming Microsoft Dynamics® NAV 2013
Credits
Foreword
About the Authors
Acknowledgements
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
A Business history timeline
The beginning
Single user PC Plus
Multiuser Navigator
Navision financials for Windows
Growth and mergers
Continuous enhancement
C/AL's roots
What you should know
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. An Introduction to NAV 2013
NAV 2013 – an ERP system
Financial Management
Manufacturing
Supply Chain Management (SCM)
Business Intelligence and reporting (BI)
Relationship Management (RM)
Human Resource management (HR)
Project Management
Significant changes for NAV 2013
Application changes
Client enhancements
Development tools
Other areas
A developer's overview of NAV 2013
NAV object types
C/SIDE
Object Designer tool icons
C/AL programming language
NAV object and system elements
NAV functional terminology
User Interface
Developing in NAV 2013 – hands-on
Our scenario for development exercises
Getting started with the application design
Application tables
Designing a simple table
Creating a simple table
Pages
List pages
Card pages
Document pages
Journal/Worksheet pages
Standard elements of pages
Creating a List page
Creating a Card page
Creating some sample data
Creating a List Report
Much more to come
Other NAV object types
Codeunits
Queries
MenuSuites
XMLports
Backups and documentation
Summary
Review questions
2. Tables
An overview of tables
Components of a table
Naming a table
Table numbering
Table properties
Table triggers
Keys
SumIndexFields
Field Groups
Enhancing our sample application
Creating and modifying tables
Assigning a Table Relation property
Assigning an InitValue property
Adding a few activity-tracking tables
New tables for our WDTU project
New list pages for our WDTU project
Keys, SumIndexFields, and table relations in our examples
Secondary keys and SumIndexFields
Table relations
Modifying a standard table
Version list documentation
Types of tables
Fully Modifiable tables
Master
Journal
Template
Ledger
Reference tables
Register
Posted Document
Setup
Temporary
Content Modifiable tables
System
Read-only tables
Virtual
Summary
Review questions
3. Data Types and Fields
Basic definitions
Fields
Field properties
Field triggers
Data structure examples
Field numbering
Field and Variable naming
Data types
Fundamental data types
Numeric data
String data
Date/Time data
Complex data types
Data structure
Objects
Automation
Input/Output
DateFormula
References and other data types
Data type usage
FieldClass property options
FieldClass – Normal
FieldClass – FlowField
FieldClass – FlowFilter
FlowFields and a FlowFilter for our application
Filtering
Experimenting with filters
Accessing filter controls
Development Environment filter access
Role Tailored Client filter access
Summary
Review questions
4. Pages – the User's Interactive Interface
Page Design and Structure Overview
Page Design Guidelines
NAV 2013 Page structure
Types of pages
Role Center page
List page
Card page
Document page
FastTab
ListPlus page
Worksheet (Journal) page
ConfirmationDialog page
StandardDialog page
NavigatePage
Special pages
Request page
Departments page
Page parts
FactBox Area
CardParts and ListParts
Charts
Chart part
Chart Control Add-in
Page names
Page Designer
New Page Wizard
Page Components
Page Triggers
Page properties
Page Preview tool
Inheritance
WDTU Page Enhancement – part 1
Page Controls
Control Types
Container controls
Group controls
Field controls
Page Part controls
Page Control triggers
Bound and Unbound Pages
WDTU Page Enhancement – part 2
Page Actions
Page Action Types and Subtypes
Action Groups
Action Properties
Navigation Pane Button actions
Actions Summary
Learning more
UX (User Experience) Guidelines
Creative plagiarism
Experimenting on your own
Experimentation
Summary
Review questions
5. Queries and Reports
Queries
Building a simple Query
Query and Query component properties
Query properties
The DataItem properties
Column properties
Filter properties
Reports
What is a report?
Two NAV report designers
NAV report types
Report types summarized
Report naming
Report components – overview
Report structure
Report data overview
Report Layout overview
Report data flow
Report components – detail
C/SIDE Report properties
Visual Studio Report properties
Report triggers
Request Page properties
Request Page triggers
Data item properties
Data Item triggers
Creating a Report in NAV 2013
Learn by experimentation
Report building – phase 1
Report building – phase 2
Report building – phase 3
Modifying an existing report
Runtime rendering
Inheritance
Interactive report capabilities
Interactive sorting
Interactive visible/not visible
Request Page
Add a Request Page option
Processing-Only reports
Creative report plagiarism
Summary
Review questions
6. Introduction to C/SIDE and C/AL
Understanding C/SIDE
Object Designer
Starting a new object
Accessing the Table Designer
Accessing the Page Designer
Accessing the Report Dataset Designer
Accessing the Codeunit Designer
Query Designer
XMLport Designer
MenuSuite Designer
Object Designer navigation
Exporting objects
Importing objects
Text objects
Some useful practices
Changing data definitions
Saving and compiling
Some C/AL naming conventions
Variables
C/AL Globals
C/AL Locals
Function local identifiers
Other local identifiers
Special working storage variables
Temporary tables
Arrays
Initialization
System-defined variables
C/SIDE programming
Non-modifiable functions
Modifiable functions
Custom functions
Creating a function
C/AL syntax
Assignment and punctuation
Expressions
Operators
Arithmetic operators and functions
Boolean operators
Relational operators and functions
Precedence of operators
Frequently used C/AL functions
The MESSAGE function
The ERROR function
The CONFIRM function
The STRMENU function
Record functions
The SETCURRENTKEY function
The SETRANGE function
The SETFILTER function
The GET function
FIND functions
FIND ([Which]) options and the SQL Server alternates
Conditional statements
The BEGIN–END compound statement
The IF–THEN–ELSE statement
Indenting code
Some simple coding modifications
Adding field validation to a table
Adding code to a report
Layout the new report heading
Save and test
Lookup Related table data
Layout the new report body
Save and test
Handling user-entered selection criteria
Defining the Request Page
Finishing the processing code
Test the completed report
Output to Excel
Summary
Review questions
7. Intermediate C/AL
Some C/AL development tools
C/AL Symbol Menu
Internal documentation
Validation functions
TESTFIELD
FIELDERROR
INIT
VALIDATE
Date and Time functions
TODAY, TIME, and CURRENTDATETIME functions
WORKDATE function
DATE2DMY function
DATE2DWY function
DMY2DATE and DWY2DATE functions
CALCDATE function
Data conversion and formatting functions
ROUND
FORMAT function
EVALUATE function
FlowField SumIndexField functions
CALCFIELDS function
SETAUTOCALCFIELDS function
CALCSUMS function
CALCFIELDS and CALCSUMS comparison
Flow control
REPEAT-UNTIL
WHILE-DO
FOR-TO or FOR-DOWNTO
CASE-ELSE statement
WITH-DO statement
QUIT, BREAK, EXIT, and SKIP functions
QUIT function
BREAK function
EXIT function
SKIP function
Input and Output functions
NEXT function with FIND or FINDSET
INSERT function
MODIFY function
Rec and xRec
DELETE function
MODIFYALL function
DELETEALL function
Filtering
SETFILTER function
COPYFILTER and COPYFILTERS functions
GETFILTER and GETFILTERS functions
FILTERGROUP function
MARK function
CLEARMARKS function
MARKEDONLY function
RESET function
InterObject communication
Communication via data
Communication through function parameters
Communication via object calls
Enhancing the WDTU application
Modifying table fields
Adding validation logic
Playlist Header Validations
Creating the Playlist Subform page
Playlist Line validations
Creating a function
Creating a FactBox page
Summary
Review questions
8. Advanced NAV Development Tools
NAV process flow
Initial setup and data preparation
Transaction entry
Testing and posting the Journal Batch
Utilizing and maintaining the data
Data maintenance
Role Center pages
Role Center structure
Role Center activities page
Cue Groups and Cues
Cue source table
Cue Group Actions
System Part
Page Parts
Page Parts not visible
Page Part Charts
Page Parts for user data
Navigation Pane and Action Menus
Action Designer
Creating a WDTU Role Center Ribbon
Promoted Actions Categories
Action Groups
Configuration/Personalization
Navigation Pane
Navigation Home Button
Navigation Departments Button
Other Navigation Buttons
XMLports
XMLport components
XMLport properties
XMLport triggers
XMLport data lines
XMLport line properties
SourceType as Text
SourceType as Table
SourceType as Field
Element or Attribute
NodeType of Element
NodeType of Attribute
XMLport line triggers
DataType as Text
DataType as Table
DataType as Field
XMLport Request Page
Web services
Exposing a web service
Publishing a web service
Determining what was published
XMLport – web services integration example
Summary
Review questions
9. Develop, Debug, Deliver
Creating new C/AL routines
Callable functions
Codeunit 358 – Date Filter-Calc
Codeunit 359 – Period Form Management
Codeunit 365 – Format Address
Codeunit 396 – NoSeriesManagement
Function models to review and use
Management codeunits
Multi-language system
Multi-currency system
Navigate
Modifying for Navigate
Debugging in NAV 2013
Text Exports of Objects
Dialog function debugging techniques
Debugging with MESSAGE and CONFIRM
Debugging with DIALOG
Debugging with text output
Debugging with ERROR
The new NAV 2013 Debugger
Activating the Debugger
Attaching the Debugger to a Session
Creating break events
The Debugger window
Changing the code while debugging
C/SIDE Test-driven development
Other Interfaces
Automation Controller
Linked data sources
NAV Application Server (NAS)
Client Add-ins
Client Add-in construction
WDTU Client Add-in
Client Add-in comments
Customizing Help
NAV development projects – some general guidance
Knowledge is key
Data-focused design
Defining the needed data views
Designing the data tables
Designing the user data access interface
Designing the data validation
Data design review and revision
Designing the Posting processes
Designing the supporting processes
Double-check everything
Design for efficiency
Disk I/O
Locking
Updating and upgrading
Design for updating
Customization project recommendations
One change at a time
Testing
Database testing approaches
Testing in production
Using a testing database
Testing techniques
Deliverables
Finishing the project
Plan for upgrading
Benefits of upgrading
Coding considerations
Good documentation
Low-impact coding
Supporting material
Summary
Review questions
A. Answers to Review Questions
Chapter 1, An Introduction to NAV 2013
Chapter 2, Tables
Chapter 3, Data Types and Fields
Chapter 4, Pages – the User's Interactive Interface
Chapter 5, Queries and Reports
Chapter 6, Introduction to C/SIDE and C/AL
Chapter 7, Intermediate C/AL
Chapter 8, Advanced NAV Development Tools
Chapter 9, Develop, Debug, Deliver
Index
Programming Microsoft Dynamics® NAV 2013
Programming Microsoft Dynamics® NAV 2013
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Microsoft, Microsoft Dynamics, and Dynamics NAV are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Programming Microsoft Dynamics® NAV 2013 is an independent publication and is not affiliated with, nor has it been authorized, sponsored or otherwise approved by Microsoft Corporation.
First published: February 2013
Production Reference: 1190213
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-648-8
www.packtpub.com
Cover Image by David Studebaker (<das189@tigereye.com>)
Credits
Authors
David A. Studebaker
Christopher D. Studebaker
Reviewers
Scott Barber
Daniel Rimmelzwaan
Kamil Sáček
Luc Van Dyck
Steven Renders
Acquisition Editor
Erol Staveley
Lead Technical Editor
Suchi Singhal
Technical Editors
Vrinda Amberkar
Nitee Shetty
Dominic Pereira
Project Coordinator
Joel Goveya
Proofreaders
Ting Baker
Joel T. Johnson
Mario Cecere
Indexers
Monica Ajmera Mehta
Tejal R. Soni
Rekha Nair
Graphics
Aditi Gajjar
Sheetal Aute
Production Coordinators
Aparna Bhagat
Nilesh R. Mohite
Pooja Chiplunkar
Cover Work
Nilesh R. Mohite
Foreword
Like many other enthusiasts in the NAV community, David runs a family business with his wife Karen. Their son Christopher got his start in NAV working in the family business. This is the kind of business which made NAV more successful than any other product in the ERP mid-market and we in the NAV R&D team can thank David, Karen and Christopher for their involvement in the product and the community which made NAV what it is today.
Like David I have had the pleasure of being part of the Dynamics NAV story for more than two decades—but on R&D team. Being a part of this for so long, I also have my favorite releases, each of which has meant something special to me:
Navigator 3.56: The Last DOS version
. With a full IDE, the AL language, multiplatform support and a high performing database (does anybody remember SCO Unix) this concluded an era with an extremely high quality release, which is still used by many customers today.
Navision 2.60: The Windows release
which matched 3.56 in terms of quality and in addition had COM support, new object oriented features in C/AL and a fantastic Windows UI. The beauty of simplicity
.
Dynamics NAV 2013: The New NAV runtime release
which introduces a completely new, highly scalable, managed runtime with deep integration into .NET, SQL, and Office. NAV 2013 also included an array of new client features using the same page definition, with more to come.
David has written fantastic books about previous versions of NAV – but reading David and Christopher's new book reveals to me that NAV 2013 is their favorite too!
Michael Nielsen
Director of Engineering
Dynamics NAV at Microsoft
About the Authors
David Studebaker is Chief Technical Officer and a founder of Liberty Grove Software with his partner Karen Studebaker. Liberty Grove Software, a Microsoft Partner, provides development, consulting, training, and upgrade services internationally for Microsoft Dynamics NAV resellers and end user customers.
David has been recognized by Microsoft as a Certified Professional for NAV in all three areas: Development, Applications, and Installation & Configuration. He has been honored by Microsoft as a Lead Certified Microsoft Trainer for NAV.
David just celebrated his first half century of programming, having started programming in 1962. He has been developing in C/AL since 1996. David has been an active participant in each step of computing technology from the first solid state mainframes to today's technology, from binary assembly language coding to today's C/AL and C#.
David's special achievements include his role as co-developer of the first production multi-programmed SPOOLing system in 1967. David has worked on a diverse set of software applications including manufacturing, distribution, retail, engineering, general accounting, association management, professional services billing, distribution/inventory management, freight carriage, data collection and production management, among others. Prior to co-authoring this book, David was the author of Programming Microsoft Dynamics NAV (for the Classic Client) and Programming Microsoft Dynamics NAV 2009 (for the Role Tailored Client).
David has had a wide range of development, consulting, sales and management roles throughout his career. He has been partner or owner and manager of several software development businesses, while always maintaining a hands-on role as a business applications developer.
David has a BS in Mechanical Engineering from Purdue University and an MBA from the University of Chicago. He has been writing for publication since he was an undergraduate. David has been a member of the Association for Computing Machinery since 1963 and was a founding officer of two local chapters of the ACM.
Christopher Studebaker, a NAV Developer/Implementer, has 12 years' experience designing, developing, implementing and selling the NAV and SQL Server environments. He has specialized in retail, manufacturing, job shop, and distribution implementations, most in high user-count, high data volume applications. Chris has worked on many NAV implementations with integrations to external databases and third party add-on products. Some special applications have included high volume order entry, pick-to-light systems, procurement analysis and Web frontends.
Chris acts in a consulting and training role for customers and for peer NAV professionals. He provides training both in informal and classroom situations, often developing custom course material to support courses tailored to specific student group needs. Courses have included various NAV functional and development areas.
Before becoming a certified NAV developer, Chris was a certified environmental consultant working with manufacturing facilities to meet national and state regulations. His duties included regulatory reporting, data analysis, project management and subcontractor oversight. Accomplishments included obtaining several safety certifications and managing projects for hazardous material management and abatement.
Chris is a Microsoft Certified IT Professional, SQL Database Developer, as well as a Microsoft Certified Business Solutions Professional in NAV Development and NAV Installation and Configuration. He has a Bachelor of Science degree from Northern Illinois University and has done graduate work at Denmark Technical University.
Acknowledgements
David's Personal Acknowledgements
The work on this book would not have been possible without my co-author (and son) Christopher Studebaker. Chris' broad experience with and in depth technical knowledge of NAV made it possible for us to deliver this book. I'm a very lucky father to get to work with such a smart, knowledgeable son.
I would like to especially thank my partner in life and work, Karen Studebaker, for her unflagging support, patience, love and encouragement in all ways. No one could have a more wonderful partner or spouse. The first 50 years have been great; I'm looking forward to the next 50.
I would like to acknowledge the guidance and love that I received from my parents. They always were able to see the good in people. They expected their children to do their best and helped us to do so. Foremost, they expected us to treat others well and they led by their examples.
One of my life's treasures is the enthusiastic support and love of my wonderful children, Christopher and Rebecca, of whom I am very proud. Both Becky and Chris are high achievement professionals and managers who are thoughtful and caring of others in all aspects of their lives. Most importantly, they place the highest value on their roles as parents and spouses.
Much of my knowledge about NAV was developed while working with a terrific team of associates at Studebaker Technology and later at Liberty Grove Software. For many years I have had the good fortune to work with intelligent, dedicated people who are also my friends.
Finally, though there are far too many additional individuals to list, whatever I have been able to accomplish would not have been possible without the help of many, many friends, mentors and associates along the way. Life would be very poor without all the kind and generous folks I have met.
May you enjoy using this book as even a fraction as much as I enjoyed working on it with Chris.
Christopher's Personal Acknowledgements
First and foremost I would like to thank my parents, David and Karen Studebaker, for giving me the opportunity in starting in the NAV world, and allowing me the room to grow on my own. Of course I could not have participated in this book if it weren't for my wife, Beth. Having worked within the NAV community for the past decade, I have worked with many wonderful people, most notably my parents (of course), Betty Cronin, Kathy Nohr, Tommy Madsen, Susanne Priess, David Podjasek, Diane Beck, Hasse Nielsen, Ahmed Amini, Chris Pashby, and Joy Bensur. Without them, I would not be the NAV professional I am today.
Authors' Joint Acknowledgements
We wish to express our deep appreciation to the Dynamics NAV experts, the technical reviewers for this book. Scott Barber, Steven Renders, Daniel Rimmelzwaan, Kamil Sacek and Luc Van Dyck all generously contributed their time and immeasurable amounts of their expertise to the task of reviewing our work. Their combined store of knowledge about Dynamics NAV is amazing. The good qualities in this book are due in no small part to the contributions of these individuals. We appreciate their hard work and wish to thank each of them very much.
We want to offer special thanks to Michael Nielsen of Microsoft for his wholehearted support of this and the previous Programming NAV books.
We wish to thank the great people at Microsoft and the crew of editors and other professionals at Packt Publishing who patiently assisted us with their contributions throughout the creation of this book.
About the Reviewers
Scott Barber, as a MS NAV Developer/Consultant for Tectura, is responsible for designing and the ERP systems to meet customer requirements. His responsibilities include system design and development, performing conversions, and supporting existing customers. Scott has been working with Navision since 1995 and has over 28 years of accounting software implementation experience.
Scott has worked with many of Tectura's customers in North America, as a result, he brings a depth of business knowledge to his development/consulting work. He is a skilled trainer and teaches courses in the classroom and on-site in all areas of Navision including the development environment.
Scott is currently implementing NAV in global environments in addition to working in the North American market.
Scott received his BS in Accounting at Utah State University.
Daniel Rimmelzwaan was born and raised in the Netherlands, and moved to the U.S. at the end of 1999 to be with his new American wife. In Holland he worked as a Microsoft Access and VBA developer. When looking for a job as a VB developer in the USA, he was introduced to Navision by a VB Recruiter
, and was intrigued by the simplicity of its development tools. He decided to accept a job offer as a Navision Developer, with the firm intention to continue looking for a real
developer job.
More than 13 years later, having been involved in all aspects of NAV implementations, Daniel is still working with NAV. He currently owns his own business (RIS Plus), doing Business Analysis and Solution Design. He is enjoying his career more than ever.
Ever since he started working with NAV, Daniel has been an active member of the online communities, such as mibuso.com and dynamicsuser.net, and the online forums managed by Microsoft. For his contributions to these communities, Daniel received his first of eight consecutive Microsoft Most Valuable Professional Awards in July 2005, which was just the second year that the award existed for NAV. Microsoft gives the MVP Award to independent members of technology communities around the world, and recognizes people that share their knowledge with other members of the community.
Daniel has also served as a reviewer for Microsoft Dynamics NAV 2009 Application Design by Mark Brummel, and Microsoft Dynamics NAV 2009 Professional Reporting by Steven Renders.
He lives with his wife and two kids in Michigan in the U.S.
Kamil Sáček (Kine) graduated from the Brno University of Technology in 2001. After that he began work as a Navision developer with NAVERTICA a.s. (formerly FUTURE Engineering a.s.), where he works to this day, now as Department Manager of Software Development.
Working with computers since his first Atari 800XE, mostly without any available literature regarding computer science, he learned everything by trial and error in his early years. From Basic, Pascal, Assembler, C, C++, C#, MS SQL, Windows, and Linux administration to VoIP gateway configuration. As a technical geek he enjoys playing with all new technologies which are of use to him. His 30 years of experience with different technologies has given him a wide knowledge base, allowing him to solve nearly any problem which he encounters.
Since 2005 he has been consecutively awarded MVP (Microsoft Most Valuable Professional) status in Microsoft Dynamics NAV, mostly for his activities on the mibuso.com forum, where you can read his regular posts under the alias Kine.
Luc Van Dyck is active as a software consultant and works for a Belgian Microsoft partner. He started working with Microsoft Dynamics NAV in 1997 (at that time it was called Navision Financials 1.10).
In the year 1999, he started the website http://myNavision.net to provide a forum and downloads for users of the Dynamics NAV ERP system. When Microsoft bought Navision Software A/S in 2002, the site was renamed to http://mibuso.com; mibuso.com is one of the largest online communities of Microsoft Dynamics professionals.
This online community gives users and developers of products from the Microsoft Dynamics family (NAV, AX, CRM, and so on) a place to exchange ideas and tools, and to find business partners and products. The website provides a forum where you can ask questions about the different Dynamics products. It also contains a large selection of downloads, in different categories (code examples, demo versions, webcasts, factsheets, tools, and so on). Microsoft partners can submit their company details to the Business Directory and publish their add-ons or factsheets in the Product Directory.
mibuso.com also organizes two-day technical conferences, called NAV TechDays, for all Microsoft Dynamics NAV developers.
Steven Renders is a Microsoft Certified Trainer with skills spanning business and technical domains, specialized in Microsoft Dynamics NAV and Microsoft SQL Server.
He has more than 15 years of business and technical experience. He provides training and consultancy focused on Microsoft Dynamics NAV, Microsoft SQL Server, Business Intelligence Solutions, Microsoft SQL Server Reporting Services, and Database Performance Tuning.
Furthermore he is also an expert in Microsoft Dynamics NAV on which he has already delivered many training sessions. Steven was an author of some of the official training materials on Dynamics NAV Reporting, SQL Server performance tuning and development.
Steven is the author of the book, Microsoft Dynamics NAV 2009: Professional Reporting and was also a reviewer of the book, Programming Microsoft® Dynamics™ NAV 2009.
Steven has presented at various Microsoft MSDN and TechNet evenings, conferences, communities, events and the Microsoft MCT Summit.
In 2011 Steven started his own company, think about IT, which specializes in training and consultancy, helping companies learn, implement, understand, and solve complex business requirements related to IT, in Belgium and abroad.
His specialties are:
Microsoft Dynamics NAV
Microsoft SQL Server
Business Intelligence and Reporting
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
Preface
Congratulations on beginning your study of Microsoft Dynamics NAV, C/SIDE and C/AL. You are joining a high-quality, worldwide group of experienced developers. This is a collegial community of C/AL developers who readily and generously share their knowledge. There are formal and informal organizations of NAV-focused users, developers, and vendor firms on the Web and scattered around the globe. NAV is one of the best customizable ERP systems on the market. It continues to grow and prosper.
The information in this book will help you to shorten your learning curve on how to program for the NAV 2009 ERP system using the C/AL language, the C/SIDE integrated development environment and their capabilities. Welcome aboard and enjoy the journey.
A Business history timeline
The current version of Microsoft Dynamics NAV is the result of inspiration and hard work along with some good fortune and excellent management decision making over almost the last thirty years.
The beginning
Three college friends, Jesper Balser, Torben Wind, and Peter Bang, from Denmark Technical University (DTU) founded their computer software business in 1984 when they were in their early twenties. That business was Personal Computing & Consulting (PC & C) and its first product was called PC Plus.
Single user PC Plus
PC Plus was released in 1985 with a primary goal of ease of use. An early employee said its functional design was inspired by the combination of a manual ledger journal, an Epson FX 80 printer, and a Canon calculator. Incidentally, Peter Bang is the grandson of one of the founders of Bang & Olufsen, the manufacturer of home entertainment systems par excellence.
PC Plus was PC DOS-based, a single-user system. PC Plus' design features included:
An interface resembling the use of documents and calculators
Online help
Good exception handling
Minimal computer resources required
The PC Plus product was marketed through dealers in Denmark and Norway.
Multiuser Navigator
In 1987, PC & C released a new product, the multiuser Navigator and a new corporate name, Navision. Navigator was quite a technological leap forward. It included:
Client/Server technology
Relational database
Transaction-based processing
Version management
High-speed OLAP capabilities (SIFT technology)
A screen painter tool
A programmable report writer
In 1990, Navision was expanding its marketing and dealer recruitment efforts into Germany, Spain, and the United Kingdom. Also in 1990, V3 of Navigator was released. Navigator V3 was still a character-based system, albeit a very sophisticated one. If you had an opportunity to study Navigator V3.x, you would instantly recognize the roots of today's NAV product. By V3, the product included:
A design based on object-oriented concepts
Integrated 4GL Table, Form, and Report Design tools (the IDE)
Structured exception handling
Built-in resource management
The original programming language that became C/AL
Function libraries
The concept of regional or country-based localization
When Navigator V3.5 was released, it also included support for multiple platforms and multiple databases. Navigator V3.5 would run on both Unix and Windows NT networks. It supported Oracle and Informix databases as well as the one developed in-house.
At about this time, several major strategic efforts were initiated. On the technical side, the decision was made to develop a GUI-based product. The first prototype of Navision Financials (for Windows) was shown in 1992. At about the same time, a relationship was established that would take Navision into distribution in the United States. The initial release in the US in 1995 was V3.5 of the character-based product, rechristened Avista for US distribution.
Navision financials for Windows
In 1995, Navision Financials V1.0 for Microsoft Windows was released. This product had many (but not all) of the features of Navigator V3.5. It was designed for complete look-and-feel compatibility with Windows 95. There was an effort to provide the ease of use and flexibility of development of Microsoft Access. The new Navision Financials was very compatible with Microsoft Office and was thus sold as being familiar to any Office user
. Like any V1.0 product, it was fairly quickly followed by a V1.1 that worked much better.
In the next few years, Navision continued to be improved and enhanced. Major new functionalities were added:
Contact Relation Management (CRM)
Manufacturing (ERP)
Advanced Distribution (including Warehouse Management)
Various Microsoft certifications were obtained, providing muscle to the marketing efforts. Geographic and dealer base expansion continued apace. By 2000, according to the Navision Annual Report of that year, the product was represented by nearly 1,000 dealers (Navision Solution Centers) in 24 countries and used by 41,000 customers located in 108 countries.
Growth and mergers
In 2000, Navision Software A/S and its primary Danish competitor, Damgaard A/S, merged. Product development and new releases continued for the primary products of both original firms (Navision and Axapta). In 2002, the now much larger Navision Software, with all its products (Navision, Axapta, and the smaller, older C5 and XAL) was purchased by Microsoft, becoming part of the Microsoft Business Systems division along with the previously purchased Great Plains Software business and its several product lines. The Navision and Great Plains products all received a common rebranding. Navision was renamed to Dynamics NAV.
Continuous enhancement
As early as 2003, research began with the Dynamics NAV development team planning moves to further enhance NAV, taking advantage of various parts of the Microsoft product line. Goals were defined to increase integration with products such as Microsoft Office and Microsoft Outlook. Goals were also set to leverage the functional capabilities of Visual Studio and SQL Server, among others. All the while, there was a determination not to lose the strength and flexibility of the base product.
This was to be a massive change that would require an almost complete rewrite of the underlying code, the foundation that's normally not visible to the outside world. To accomplish that while not destroying the basic user interface, the business application model or the development environment, turned out to be a larger, more complex effort than hoped for. The first public views of this new version of the system, a year or two later, were not greeted with universal enthusiasm from the NAV technical community. But the Dynamics NAV development team persevered and Microsoft continued supporting the investment, until NAV 2009 was released in late 2008 followed by NAV 2013 in late 2012. The biggest hurdles to the new technologies had been cleared.
A new user interface, the Role Tailored Client, was created as part of this renewal. NAV is now based on Microsoft's SQL Server and is well integrated with other Microsoft products such as Office, Outlook and SharePoint. The new product versions take increasing advantage of SQL Server technologies. Development is more integrated with Visual Studio and more .NET compliant. The product is becoming more open and, at the same time, more sophisticated, supporting features such as Web Services access, integration of third-party controls, and RDLC reporting. In our industry, it would be appropriate to say To survive is to change.
Change and survival are part of what Dynamics NAV does very well.
Microsoft continues to invest in, enhance, and advance NAV. More new capabilities and features are yet to come, continuing to build on the successes of the past. We all benefit.
C/AL's roots
One of the first questions asked by people new to C/AL is often what other programming language is it like?
The best response is Pascal
. If the questioner is not familiar with Pascal, the next best response would be C
or C#
.
At the time the three founders of Navision were attending classes at Denmark Technical University (DTU), Pascal was in wide use as a preferred language not only in computer courses, but in other courses where computers were tools and software had to be written for data analyses. Some of the strengths of Pascal as a tool in an educational environment also served to make it a good model for Navision's business applications development.
Perhaps coincidentally (perhaps not) at DTU in this same time period, a Pascal compiler called Blue Label Pascal was developed by Anders Hejlsberg. That compiler became the basis for what was Borland's Turbo Pascal, which was the everyman's compiler
of the 1980s because of its low price. Anders went with his Pascal compiler to Borland. While he was there Turbo Pascal morphed into the Delphi language and IDE tool set under his guidance.
Anders later left Borland and joined Microsoft, where he led the C# design team. Much of the NAV-related development at Microsoft is now being done in C#. So the Pascal-C/AL-DTU connection has come full circle, only now it appears to be C#-C/AL. Keeping it in the family, Anders' brother, Thomas Hejlsberg also works at Microsoft on NAV. Each in their own way, Anders and Thomas continue to make significant contributions to Dynamics NAV.
In a discussion about C/AL and C/SIDE, Michael Nielsen of Navision and Microsoft, who developed the original C/AL compiler, runtime, and IDE, said that the design criteria were to provide an environment that could be used without:
Dealing with memory and other resource handling
Thinking about exception handling and state
Thinking about database transactions and rollbacks
Knowing about set operations (SQL)
Knowing about OLAP (SIFT)
Paraphrasing some of Michael's additional comments, the goals of the language and IDE design were to:
Allow the developer to focus on design, not coding, but still allow flexibility
Provide a syntax based on Pascal stripped of complexities, especially relating to memory management
Provide a limited set of predefined object types, reducing the complexity and learning curve
Implement database versioning for a consistent and reliable view of the database
Make the developer and end user more at home by borrowing a large number of concepts from Office, Windows, Access, and other Microsoft products
Michael is still working as part of the Microsoft team in Denmark on new capabilities for NAV. Another example of how, once part of the NAV community, most of us want to stay part of that community.
What you should know
This book will not teach you programming from scratch, nor will it tutor you in business principles. To get the maximum out of this book, you should come prepared with some significant experience and knowledge including the following attributes:
Experienced developer
More than one programming language
IDE experience
Knowledgeable about business applications
Good at self-directed study
If you have those attributes, then by careful reading and performance of the suggested exercises in this book, it will help you become productive with C/AL and NAV much more rapidly. In addition, your knowledge will be broader and deeper than it would be otherwise.
For executives, consultants, managers and others who aren't developers, but want to learn about the development technology and capabilities of Dynamics NAV, this book is still an excellent resource. If you fit in one of those or similar categories, start by studying Chapter 1, An Introduction to NAV 2013, in detail for a good overview of what NAV is and its tools. Then review sections of other chapters as the topics apply to your areas of interest.
This book's illustrations are from the W1 Cronus database V2013.
Hopefully this book will smooth your path to knowledge of Dynamics NAV 2013 and shine a little light on challenges and opportunities alike. Your job is to take advantage of this opportunity to learn, to expand your knowledge of NAV, and then use your new skills productively.
What this book covers
Chapter 1, An Introduction to NAV 2013, starts with an overview of NAV as a business application system. This is followed by an introduction to the seven types of NAV objects, and the basics of C/AL and C/SIDE. Then we will do some hands-on work, defining Tables, multiple Page types, and a Report. We'll close with a brief discussion of how backups and documentation are handled in C/SIDE.
Chapter 2, Tables, focuses on the foundation level of NAV data structure—Tables and their structures. We will cover Properties, Triggers (where C/AL resides), Field Groups, Table Relations and SumIndexFields. We'll work our way through hands-on creation of several tables in support of our example application. We will also review the types of tables found in the NAV applications.
Chapter 3, Data Types and Fields, will help you learn about fields, the basic building blocks of NAV data structure. We will review the different data types in NAV. We will cover all the field properties and triggers in detail. We'll also review the three different Field classes. We'll conclude with a discussion of the concept of filtering and how it should be considered in database structure design.
Chapter 4, Pages – the User's Interactive Interface, covers the different types of pages, their structures (Triggers, Properties) and general usage. We'll build several pages for our example application using the Page Wizard and Page Designer. We will also study the different types of controls that can be used in pages. In addition we'll review how and where actions are added to pages.
Chapter 5, Queries and Reports, will help you learn about both Queries and Reports, two methods of extracting data for presentation to users. For Queries, we will study how they are constructed and some of the ways they are utilized. For Reports, we will walk through report data flow and the variety of different report types. We will study the two Report Designers, the C/SIDE Report Designer and the Visual Studio Report Designer and how a NAV report is constructed using both of these. We'll learn what aspects of reports use one designer and what aspect use the other. As in previous studied objects, we will discuss Properties and Triggers. We will review how reports can be made interactive and will do some hands-on report creation.
Chapter 6, Introduction to C/SIDE and C/AL, will help you learn about general Object Designer Navigation as well as the individual Designers (Table, Page, Report). We'll study C/AL code construction, syntax, variable types, expressions, operators and functions. We will then take a closer look at some of the more frequently used built-in functions. This chapter will wrap up with an exercise adding some C/AL code to report objects created in an earlier exercise.
Chapter 7, Intermediate C/AL, explores the C/AL development tools and techniques. We will review some more advanced built-in functions including those relating to dates and decimal calculations, both critical business application tools. We'll study C/AL functions that support process flow control functions, input/output, and filtering. Then we'll do a review of methods of communication between objects. Finally, we'll apply some of what we've learned to enhancing our example application.
Chapter 8, Advanced NAV Development Tools, we will review some of the more important elements of the Role Tailored User Experience, in particular the Role Center Page construction. We will dig into the components of a Role Center Page and how to build one. We'll also cover two of the powerful ways of connecting NAV applications to the world outside of NAV, XMLports and Web Services. To better understand these, we will not only review their individual component parts, but will go through the hands-on effort of building an example of each one.
Chapter 9, Develop, Debug, Deliver, covers in detail how NAV functions are constructed and learn how to construct our own functions. We learn more about tools and features built into C/AL and C/SIDE. We will study the new debugger, review the support for Test-driven Development, and take a look at the ability to integrate .NET Client Add-ins. We will integrate a .NET Add-in into our example applications. Finally, we will review tips for design efficiency, updating and upgrading the system, all with the goal of helping us to become more productive, high quality NAV developers.
Appendix A, Answers to Review Questions, contains answers for all the review questions that appear at the end of each chapter.
Appendix B, Review Questions with Answers, contains all the review questions along with the answers. This is not present in the book but is available as a free download from the following link: http://www.packtpub.com/sites/default/files/downloads/6488EN_App_Final.pdf.
What you need for this book
You will need some basic tools including at least the following:
A license and database that you can use for development experimentation. An ideal license is a full Developer's license. If the license only contains the Page, Report, and Table Designer capabilities, you will still be able to do many of the exercises, but you will not have access to the inner workings of Pages and Tables and the C/AL code contained therein.
A copy of the NAV Cronus demo/test database for your development testing and study. It would be ideal if you also had a copy of a production database at hand for examination as well. This book's illustrations are from the W1 Cronus database for V2013.
Access to other NAV manuals, training materials, websites and experienced associates will obviously be of benefit, but they are not required for the time with this book to be a good investment.
Who this book is for
This book is for:
The business applications software designer/developer who:
Wants to become productive in NAV C/SIDE—C/AL development as quickly as possible
Understands business applications and the type of software required to support those applications
Has significant programming experience
Has access to a copy of NAV 2013 including at least the Designer granules and a standard Cronus demo database
Is willing to do the exercises to get hands-on experience
The Reseller manager or executive who wants a concise, in depth view of NAV's development environment and tool set
The technically knowledgeable manager or executive of a firm using NAV that is about to embark on a significant NAV enhancement project
The technically knowledgeable manager or executive of a firm considering purchase of NAV as a highly customizable