Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Validate routine ====== ==== 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. ^Parameters^Description^ |//indatalist//|Specifies the data to be validated and converted. Assign //indatalist// before calling Validate.| |//patternlist//|Pattern 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. ^Matches^Description^ |Range checking|(low, high)| |IConv|Refer to the [[iconv|IConv function]].| |{dictionary.item}|Any valid dictionary item, enclosed in braces [[Braces_operator|{ }]].| 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. ==== Examples ==== <code> /* 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 </code> guides/programming/programmers_reference_manual/validate.txt Last modified: 2024/06/19 20:20by 127.0.0.1