Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming Microsoft Dynamics NAV 2013

You're reading from   Programming Microsoft Dynamics NAV 2013 Experienced programmers and developers will find this the definitive guide to programming Microsoft Dynamics NAV. Both a reference book and a comprehensive hands-on tutorial, it will expand your knowledge dynamically.

Arrow left icon
Product type Paperback
Published in Feb 2013
Publisher Packt
ISBN-13 9781849686488
Length 630 pages
Edition 3rd Edition
Arrow right icon
Toc

Table of Contents (19) Chapters Close

Programming Microsoft Dynamics NAV 2013
Credits
Foreword
About the Authors
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
1. An Introduction to NAV 2013 FREE CHAPTER 2. Tables 3. Data Types and Fields 4. Pages – the User's Interactive Interface 5. Queries and Reports 6. Introduction to C/SIDE and C/AL 7. Intermediate C/AL 8. Advanced NAV Development Tools 9. Develop, Debug, Deliver Answers to Review Questions Index

Validation functions


C/AL includes a number of utility functions designed to facilitate data validation or initialization. Some of these functions are:

  • TESTFIELD

  • FIELDERROR

  • INIT

  • VALIDATE

TESTFIELD

The TESTFIELD function is widely used in standard NAV code. With TESTFIELD, we can test a variable value and issue an error message in a single statement, if the test fails. The syntax is as follows:

Record.TESTFIELD (Field, [Value])

If Value is specified and the field does not contain that value, the process terminates with an error condition and the associated error message is issued.

If no Value is specified, the condition evaluated is to check for field contents of zero or blank. If the field is zero or blank, this is an error.

The advantage of TESTFIELD is ease of use and consistency in code and in the message displayed. The disadvantage is the error message is not as informative as we might provide as a careful developer.

The following screenshot of the TESTFIELD usage is from Table 18 - Customer. This...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime