O'Reilly logo

Programming Microsoft Dynamics™ NAV 2015 by Christopher Studebaker, David Studebaker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required