Description

Validates and converts data passed to the engine based on a specified validation pattern.

Syntax

Validate (indatalist, patternlist)

Parameters

Validate accepts arguments for the following parameters.

PropertyDescription
indatalistSpecifies the data to be validated and converted. Assign indatalist before calling Validate.
patternlistPattern used to validate and convert indatalist. Assign patternlist before calling Validate.

One pattern can be assigned for each list in indatalist. If you pass more than one pattern for a list in indatalist, only the first pattern is used. If multiple lists are passed in indatalist, one pattern can be assigned for each list.

 
MatchesDescription
Range checking(low, high).
IConvRefer to the IConv function.
{dictionary.item}Any valid dictionary item, enclosed in braces { }.

Note: For Dictionary Item matching the file needs to be opened, the dictionary needs to be opened to @DICT and a record needs to be read to @record using the @id variable for the key.

Remarks

/* OpenInsight converts the date passed to the correct internal representation. Return status is true (1). */
Validate("1-1-91", "(D)")
error = Status()
/* OpenInsight converts the first date to the correct internal representation.
The second date is returned unchanged, since there is no pattern to operate against.
The return status is true (1), true (1). */
indatalist = "1-1-91":@FM:"1-2-91"
Validate(indatalist, "(D)")
error = Status()
 
/* The date and decimal columns are converted to internal format; zoo is not.
The return status is true (1), true (1), and false (0) because the last column failed the pattern match. */
indatalist = "1-1-91":@FM:"100.00":@FM:"ZOO"
patternlist = "(D)","(MD2)", "0N"
Validate(indatelist, patternlist)
error = Status()
 
**** Validate A Dictionary {} Pattern ****
Open 'CUSTOMERS' To f_customers Then
   Open 'DICT.CUSTOMERS' To @dict Then
      @id = 1
      Read @record From f_customers, @id Then
         error = ""
         * The Validation will fail and the error variable will contain a 1
         Validate("123abc", {PHONE})
         error = status()
         error = ""
         * The Validation will pass and the error variable will contain a 0    
         Validate("2017229814",{PHONE})
         error = status() end
      End Else
         FsMsg()
   end else
      FsMsg()
   end
End Else
FsmMg()
end
  • No labels