Microsoft Dynamics NAV 7 Programming Cookbook
By Rakesh Raul
()
About this ebook
Related to Microsoft Dynamics NAV 7 Programming Cookbook
Related ebooks
Oracle Essbase 11 Development Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics GP 2010 Cookbook Rating: 5 out of 5 stars5/5OData Programming Cookbook for .NET Developers Rating: 0 out of 5 stars0 ratingsMDX with SSAS 2012 Cookbook Rating: 0 out of 5 stars0 ratingsSAP BusinessObjects Dashboards 4.1 Cookbook Rating: 0 out of 5 stars0 ratingsWildFly Cookbook Rating: 0 out of 5 stars0 ratingsGetting Started with Dynamics NAV 2013 Application Development Rating: 0 out of 5 stars0 ratingsProfessional SQL Server Reporting Services Rating: 0 out of 5 stars0 ratingsCloud ERP for the Public Sector Second Edition Rating: 0 out of 5 stars0 ratingsOracle Business Intelligence Enterprise Edition 12c A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsCloud Functionality A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsORACLE 12C Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsOracle Cloud Infrastructure Third Edition Rating: 0 out of 5 stars0 ratingsOracle SOA Suite 11g Administrator's Handbook Rating: 0 out of 5 stars0 ratingsPublic Cloud ERP for Small or Midsize Businesses A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsWS-BPEL 2.0 Beginner's Guide Rating: 0 out of 5 stars0 ratingsPublic Cloud ERP For Small Or Midsize Businesses A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsOracle ADF 11gR2 Development Beginner's Guide Rating: 0 out of 5 stars0 ratingsOracle Cloud Applications A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsData Migration A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsIntegrated Business Planning A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics GP 2013 Implementation Rating: 0 out of 5 stars0 ratingsuser stories A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsIBM BigFix Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsOracle BPM Suite 11g: Advanced BPMN Topics Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics Erp Cloud Strategy A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics NAV Administration Rating: 0 out of 5 stars0 ratingsBusiness rules A Complete Guide Rating: 0 out of 5 stars0 ratingsOracle SOA BPEL Process Manager 11gR1 A Hands-on Tutorial Rating: 5 out of 5 stars5/5AWS EC2 Instance Families A Complete Guide Rating: 0 out of 5 stars0 ratings
Programming For You
Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsPython Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Python Machine Learning By Example Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python Essentials Rating: 5 out of 5 stars5/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5HTML in 30 Pages Rating: 5 out of 5 stars5/5Photoshop For Beginners: Learn Adobe Photoshop cs5 Basics With Tutorials Rating: 0 out of 5 stars0 ratings
Reviews for Microsoft Dynamics NAV 7 Programming Cookbook
0 ratings0 reviews
Book preview
Microsoft Dynamics NAV 7 Programming Cookbook - Rakesh Raul
Table of Contents
Microsoft Dynamics NAV 7 Programming Cookbook
Credits
About the Author
About the Reviewers
Acknowledgements
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
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. String, Dates, and Other Data Types
Introduction
Retrieving the system date and time
How to do it...
How it works...
There's more...
See also
Retrieving the work date
Getting ready
How to do it...
How it works...
There's more...
See also
Determining the day, month, and year from a given date
How to do it...
How it works...
There's more...
See also
Using the date formula to calculate dates
How to do it...
How it works...
There's more...
See also
Converting a value to a formatted string
How to do it...
How it works...
There's more...
See also
Creating an array
How to do it...
How it works...
There's more...
See also
Creating an option variable
How to do it...
How it works...
There's more...
See also
Converting a string to another data type
How to do it...
How it works...
There's more...
See also
Manipulating string contents
How to do it...
How it works...
There's more...
See also
2. General Development
Introduction
Displaying the progress bar and data in process
How to do it...
How it works...
There's more...
See also
Repeating code using a loop
How to do it...
How it works...
There's more...
Using a WHILE loop
Using a REPEAT..UNTIL loop
See also
Checking for conditions using an IF statement
How to do it...
How it works...
There's more...
The nested IF statement
See also
Using the CASE statement to test multiple conditions
How to do it...
How it works...
See also
Rounding decimal values
How to do it...
How it works...
See also
Creating functions
How to do it...
How it works...
There's more...
Creating local or private functions
See also
Passing parameters by reference
How to do it...
How it works...
There's more...
See also
Referencing dynamic tables and fields
How to do it...
How it works...
There's more...
See also
Using recursion
How to do it...
How it works...
There's more...
See also
3. Working with Tables, Records, and Queries
Introduction
Creating a table
How to do it...
How it works...
There's more...
See also
Adding a key to a table
How to do it...
How it works...
There's more...
See also
Retrieving data using the FIND and GET statements
How to do it...
How it works...
There's more...
See also
Advanced filtering
How to do it...
How it works...
There's more...
See also
Adding a FlowField
How to do it...
How it works...
There's more...
See also
Creating a SumIndexField
How to do it...
How it works...
There's more...
See also
Retrieving data from FlowField and SumIndexField
How to do it...
How it works...
There's more...
See also
Using a temporary table
How to do it...
How it works...
There's more...
Storing records to be processed
See also
Retrieving data from other companies
Getting ready…
How to do it...
How it works...
See also
Using a query to extract data
How to do it...
How it works...
There's more...
See also
Creating a query to link three tables
How to do it...
How it works...
There's more...
Left outer join
Inner join
Right outer join
Full outer join
Cross join
See also
Working with queries in C/AL
How to do it...
How it works...
There's more...
See also
4. Designing Pages
Introduction
Creating a page using a wizard
How to do it...
How it works...
There's more...
See also
Using multiple options to run the page
How to do it...
How it works...
There's more...
See also
Applying filters on the lookup page
How to do it...
How it works...
There's more...
See also
Updating the subform page from a parent page
How to do it...
How it works...
See also
Creating a FactBox page
How to do it...
How it works...
There's more...
See also
Creating a Queue page
How to do it...
How it works...
See also
Creating a Role Center page
How to do it...
How it works...
See also
Creating a wizard page
How to do it...
How it works...
See also
Displaying a .NET add-in on a page
Getting ready
How to do it...
How it works...
See also
Adding a chart to the page
How to do it...
How it works...
There's more...
See also
5. Report Design
Introduction
Creating an RDLC report
How to do it...
How it works...
There's more...
See also
Using multiple options to run a report
How to do it...
How it works...
See also
Adding custom filters to the Request Page
How to do it...
How it works...
There's more...
See also
Setting filters when report is loaded
How to do it...
How it works...
There's more...
See also
Creating reports to process data
How to do it...
How it works...
There's more...
See also
Creating a link from report to page
How to do it...
How it works...
There's more...
See also
Creating a link from report to report
How to do it...
How it works...
See also
Adding totals on decimal field
How to do it...
How it works...
See also
Adding interactive sorting on reports
How to do it...
How it works...
See also
Creating a matrix report
How to do it...
How it works...
There's more...
Exporting an RDLC report from viewer
Exporting an RDLC report from C/AL code
See also
6. Diagnosing Code Problems
Introduction
Using the debugger
How to do it...
How it works...
There's more...
See also
Setting breakpoints
How to do it...
How it works...
There's more...
Breakpoint options in the debugger
See also
Handling runtime errors
How to do it...
How it works...
There's more...
See also
Using About This Page and About This Report
How to do it...
About This Page
About This Report
How it works...
There's more...
How to get the subform information
See also
Finding errors while using NAS
Getting ready
How to do it...
How it works...
There's more...
See also
7. Roles and Security
Introduction
Assigning a role to a user
How to do it...
How it works...
There's more...
See also
Creating a new role
How to do it...
How it works...
There's more...
See also
Using the FILTERGROUP function
How to do it...
How it works...
See also
Using security filters
How to do it...
How it works...
There's more...
See also
Applying security filter modes
How to do it...
How it works...
There's more...
See also
Field-level security
How to do it...
How it works...
There's more...
See also
Assigning permission to use the About This Page function
How to do it...
How it works...
There's more...
About This Page for subform page
About This Page for report
See also
Killing a user session
How to do it…
How it works...
See also
8. Leveraging Microsoft Office
Introduction
Sending data to Microsoft Word
Getting ready
How to do it...
How it works...
There's more...
See also
Managing stylesheets
Getting ready
How to do it...
How it works...
Sending an e-mail from NAV through SMTP
Getting ready
How to do it...
How it works...
There's more...
Sending an HTML-formatted e-mail
Exporting data using the Excel Buffer
Getting ready
How to do it...
How it works...
There's more...
See also
Creating data connection from Excel to NAV
Getting ready
How to do it...
How it works...
There's more...
See also
Showing data in Excel using PowerPivot
Getting ready
How to do it...
How it works...
There's more...
See also
Creating an InfoPath form for the NAV data
Getting ready
How to do it...
How it works...
There's more...
See also
Creating charts with Visio
Getting ready
How to do it...
How it works...
There's more...
See also
9. OS Interaction
Introduction
Using HYPERLINK to open external files
How to do it...
How it works...
There's more...
See also
Working with environmental variables
How to do it...
How it works...
See also
Using SHELL to run external applications
How to do it...
How it works...
See also
Browsing for a file
How to do it...
How it works...
There's more...
See also
Browsing for a folder
How to do it...
How it works...
There's more...
See also
Checking file and folder access permissions
How to do it...
How it works...
See also
Querying the registry
How to do it...
How it works...
There's more...
See also
Zipping folders and files within NAV
How to do it...
How it works...
10. Integration
Introduction
Sharing information through XMLports
How to do it...
How it works...
There's more...
Exporting Sales Invoices in the CSV format
See also
Writing to and reading from a file using the C/AL code
How to do it...
How it works...
See also
Creating web services
How to do it...
How it works...
See also
Consuming web services
How to do it...
How it works...
See also
Sending data through FTP
Getting ready
How to do it...
How it works...
There's more...
See also
Printing a report in a PDF, Excel, and Word format
How to do it...
How it works...
See also
Writing your own automation using C#
How to do it...
How it works...
See also
Using ADO to access outside data
How to do it...
How it works...
11. Working with the SQL Server
Introduction
Creating a basic SQL query
How to do it...
How it works...
There's more...
See also
Understanding SIFT
How to do it...
How it works...
See also
Using the SQL profiler
How to do it...
How it works...
See also
Displaying data from a SQL view in NAV
How to do it...
How it works...
There's more...
See also
Identifying Blocked and Blocking sessions from SQL
How to do it...
How it works...
There's more...
See also
Setting up a backup plan
How to do it...
How it works...
There's more...
See also
Maintaining the transaction logfiles
Getting ready
How to do it...
How it works...
See also
12. NAV Server Administration
Introduction
Creating a NAV Server Instance
How to do it...
How it works...
There's more...
Using Microsoft Dynamics NAV Administration Shell
See also
Configuring NAS to run Job Queue
How to do it...
How it works...
There's more...
See also
Creating a user on NAV
How to do it...
How it works...
There's more...
See also
Changing the NAV license
How to do it...
How it works...
There's more...
See also
Creating a new database
How to do it...
How it works...
There's more...
See also
Testing the NAV database
How to do it...
How it works...
See also
Index
Microsoft Dynamics NAV 7 Programming Cookbook
Microsoft Dynamics NAV 7 Programming Cookbook
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 author, 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.
First published: September 2013
Production Reference: 1170913
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-910-6
www.packtpub.com
Cover Image by Jarek Blaminsky (<milak6@wp.pl>)
Credits
Author
Rakesh Raul
Reviewers
Danilo Capuano
Neil Murray
Giancarlo Zavala
Acquisition Editor
James Jones
Lead Technical Editor
Anila Vincent
Technical Editors
Veena Pagare
Jinesh Kampani
Iram Malik
Sandeep Madnaik
Shashank Desai
Copy Editors
Tanvi Gaitonde
Sayanee Mukherjee
Kirti Pai
Alfida Paiva
Adhiti Shetty
Project Coordinator
Navu Dhillon
Proofreader
Bridget Braund
Indexer
Monica Ajmera
Graphics
Abhinash Sahu
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
About the Author
Rakesh Raul is from a small town in India, with a vision of doing something big in programming. He completed his first diploma in programming at the age of 16, and continued higher studies in computer software development.
He started his programming career with a small software development company in Mumbai. After 2 years of development in Visual Basic, he was introduced to Microsoft Dynamics NAV Version 3. For the first 2-3 years he worked as a Microsoft Dynamics NAV developer and at the same time he learned all the areas of the product and earned his first Microsoft Certification-Business Solutions Professional. He continues to stay updated with new releases of the product and is certified in multiple areas for versions 4.0, 5.0, 2009, and 2013. Apart from Microsoft Dynamics NAV, he also has good knowledge of Microsoft SQL Server and Business Intelligence.
His seven-year journey with Microsoft Dynamics NAV includes more than 30 implementations; one horizontal and two vertical solution designs and development.
Currently, he works in Tectura, India, as a Senior Technical Consultant. Tectura is a worldwide provider of business consulting services delivering innovative solutions.
I would like to thank my wife, Ashwini, for supporting and always standing by my side in good and bad days.
I would like to take this opportunity to thank all the mentors I was blessed with, who unconditionally shared their knowledge and inspired me.
Mibuso and all Microsoft Dynamics NAV related blogs are a great boon for all NAV consultants. I would like to thank all the contributors of these great sites.
Love you Aabha, my cute little princess!
About the Reviewers
Danilo Capuano is a Software Engineer with over seven years of industry experience. He lives in Naples, Italy, where he earned a degree in computer science. He currently works as a developer on Microsoft Dynamics NAV in an IT company where he also completed the MCTS certification. You can visit his website: www.capuanodanilo.com or his Twitter account: @capuanodanilo.
Neil Murray began his development career as a C++ and Visual Basic developer, qualifying as a Microsoft Certified Solution Developer on Visual Basic 6.0 in 1999. He has been a Microsoft Dynamics NAV developer since 2001, providing consulting, customization, and support to customers across sub-Saharan Africa. He currently works for a large multi-national IT organization, providing technical and business process support to dairy, manufacturing, and retail clients.
I would like to thank my wife, Justine, and lovely daughters, Ember and Danica, for their love and understanding while I have dedicated precious family time to conduct the technical review of this book.
Giancarlo Zavala is an all-round expert in Microsoft Dynamics NAV technologies specializing in Application Analysis, Design and Development, and ERP implementations. He began as a network administrator in 1999 and eventually transitioned into application management. He also has a strong background with more than 15 years on Microsoft Server and networking technologies, Database Administration and Server Infrastructure deployment.
He has worked on a wide range of implementations and development projects in his career; including working as lead technical and functional consulting roles, as well as project management roles. He earned his first Microsoft Certification in SQL Database Administration in 2003, and later studied the Microsoft Dynamics ERP and CRM technologies.
He has now been managing business applications for over 10 years. He has built a unique set of skills working on full end-to-end implementations and application rollouts in various industries. He has helped various mid- to large-scale organizations successfully implement Microsoft Dynamics NAV in multiple countries around the globe, including Europe and Latin America.
Recently, he spent a couple of years in Houston working on the Oil and Energy industry with one of the largest NAV application setups around the globe. He worked on dozens of implementations as lead consultant, getting extensive knowledge of methodologies, business workflows, and best operational practices including Manufacturing, Distribution, Servicing, Warehouse Management, Intercompany Operations, Cost Accounting, and Financial Reporting amongst others. During this time, he also transitioned into design and development for Microsoft Dynamics NAV. He has worked with many of Microsoft's top partners and other well-known software vendors on multiple projects.
His passion is to always learn new skills and technologies related to Microsoft Dynamics, to create business specific solutions and to pass on his knowledge by training companies and coaching other colleagues. He enjoys building and working with a good team and taking on challenging projects with mission critical operations.
Currently, he lives in Miami and works at Tectura, U.S. as a Senior Consultant. He works on leading implementations, doing system analysis and in program development. Tectura is one of Microsoft's leading worldwide gold partners, providing consulting services and innovative solutions for small to large businesses.
Outside of work he enjoys travelling, surfing, and painting.
Acknowledgements
I want to thank everyone who helped me so that I could have the time and opportunity to work on this book. I've taken time away from the