#VALIDATE (validate prompt input) 

Top  Previous  Next

 

#VALIDATE( expression,message )

#VALIDATE

Validates the data entered into the immediately preceding #PROMPT field.

expression

The expression to use to validate the entered data.

message

A string constant containing the error message to display if the data is invalid.

The #VALIDATE statement validates the data entered into the #PROMPT field immediately preceding the #VALIDATE. The expression is evaluated when the OK button is pressed on the Procedure Properties window. If the expression is false, the message is displayed to the programmer in a message box, and control is given to the #PROMPT field that immediately precedes the #VALIDATE. There may be multiple #VALIDATE statements following a #PROMPT to validate the entry. A #PREPARE structure may follow a #PROMPT prior to the #VALIDATE, but no other template statements are valid between #PROMPT and #VALIDATE, including template comments.

Example:

#PROMPT('Input Value, Even numbers from 100-200',@N3),%Value

#VALIDATE((%Value > 100) AND (%Value < 200),'Value must be between 100 and 200')

#VALIDATE((%Value % 2 = 0),'Value must be an even number')

#PROMPT('Screen Field',CONTROL),%SomeField

#PREPARE

#FIX(%Control,%SomeField)

#ENDPREPARE

#VALIDATE(%ControlType = 'LIST','Must select a list box')

 

#PROMPT('Select Change Date/Time Group:',FIELD(%Primary)), %ChangeDateGroup,REQ

#PREPARE

#FIX(%File,%Primary)

#FIX(%Field,%ChangeDateGroup)

#ENDPREPARE

#VALIDATE(%FieldType = 'GROUP','Change Date Group must be of type GROUP!')

 

See Also:     #PROMPT