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! 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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming Microsoft Dynamics??? NAV 2015

You're reading from   Programming Microsoft Dynamics??? NAV 2015 Sharpen your skills and increase your productivity when programming Microsoft Dynamics NAV 2015

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781784394202
Length 644 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. An Introduction to NAV 2015 2. Tables FREE CHAPTER 3. Data Types and Fields 4. Pages – The Interactive Interface 5. Queries and Reports 6. Introduction to C/SIDE and C/AL 7. Intermediate C/AL 8. Advanced NAV Development Tools 9. Successful Conclusions A. Review Answers 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 generate an error message in a single statement if the test fails. The syntax is:

Record.TESTFIELD (Field, [Value] )

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

If no Value is specified, the field contents are checked for values of zero or blank. If the field is zero or blank, then that an error message is issued.

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

The following screenshot of TESTFIELD usage is from Table 18 – Customer...

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 $19.99/month. Cancel anytime
Banner background image