Navigation:  Reference > Form Objects > Common Properties >

ValidExpr

Print this Topic Previous pageReturn to chapter overviewNext page

 

This is an alpha property that you can use to save an expression that will be tested when you execute the VALID_CHECK() function.  The expression must resolve to True or False.  If it resolves to False the ValidMsg will be displayed, if there is one, or a standard valid failure message if there isn't.  Typically, you would return from the subroutine you're in if the expression returns False and, when you do, focus will be returned to the field that failed.

 

NOTE:  If you add a ValidExpr to an object on a screen form you MUST save the screen form to disk BEFORE the program is compiled.  Further, until you compile the program the ValidExpr will not be checked.  It's also important to remember that information about that expression is compiled and pointers are stored in the screen form itself.  This means if you save a screen form, compile the program, then save the screen form again without first loading the saved copy you will overwrite the information that was saved during compilation.  It's not a big deal, however, you will have to compile the program again to update the pointers in the screen form.  You can load a screen form with active ValidExpr pointers and make changes and save the screen form and those pointers will still work.  However, if you make changes to the program and then recompile, you will have changed those pointers in the screen form and you'll need to make sure if you save any forms again that they've been loaded after the compilation process.  This only applies to screen forms where you've used this expression.

 

An example of an expression you might use is part of the tutorial you receive with TAS Professional.  In the Order Number field (object: numOrdNum) the expression in the ValidExpr property is SONumber<>0.  When the VALID_CHECK() function is executed in the save routine the expression will be tested.  If the SONumber is not 0 the expression will return True, if it is 0 it will return False and the VALID_CHECK() will fail.

 

If you want the ValidExpr to be checked when the user exits the field then you must have the ValidCheckOnExit checked.

 


Page url: http://www.cassoftware.com/tas/manual/validexpr.htm