When writing or modifying an existing Data Check, there are many built-in methods available to you which expose information that you can validate against. All methods reside within a JavaScript namespace titled DataCheck.
The following tables explain the currently supported methods and global variables.
|
Global Variables |
|
|
|
Model |
|
This variable can be accessed anywhere within the Data Check and relates to the Model-Data of the current page the user is submitting. Note: The value of this model is the data currently being submitted, not the value it used to be. |
|
Context |
|
This is a variable you can use to store information shared between records, specifically in multiple record-set pages such as Receiving and Returning. |
|
Global Methods |
|
|
|
DataCheck.Alert |
|
This method is
used to send an alert message to the user, providing them with information.
It is typically useful when describing why a validation failed. |
|
DataCheck.Confirm |
Parameters Title Message Callback |
This method is used when asking a YES/NO question to the user. The callback supplied is passed a string object. If the user selects “Yes” (regardless of localization), the object contains the value “Yes”. |
|
DataCheck.Prompt |
Parameters Title Message Callback |
This method is used to accept text from the user in a pop-up message box. The callback is supplied a string object containing the text that the user supplied. |
|
DataCheck.AddValidation |
Parameters Control
Name Message |
When this method is invoked, attention is drawn to the control specified by highlighting the input box with red and attaching a tool-tip message describing why validation failed. |
|
DataCheck.SetValue |
Parameters Control
Name Message |
This method is used to set the value of a control field on the screen. Use it to change user input (for example, specifying a default date inside a date field). |
|
DataCheck.SafeNull |
Parameters Value |
This method checks for null or undefined in the input value and, if detected, replaces it with an empty string. It is used primarily as a helper function when traversing Models and SQL results. |
|
DataCheck.ExecuteSQL |
Parameters Function
Name Callback |
This method invokes the associated SQL string. The first parameter, function name, refers to the named SQL string which must be associated in grid located on the left side of the screen. The callback parameter is passed a record-set object containing the results of the SQL statement. |
|
DataCheck.UpdateRecipients |
Parameters Function
Name Callback |
This method works similar to DataCheck.ExecuteSQL. It accepts a function name which should refer to the named SQL string associated with the grid on the left side of the screen. The SQL must return a list of nContactUID values which will be used to update the recipient list of any alert that is associated with this Data Check. A dynamic Email Alert recipients lists can be created using only a Data Check. The Callback parameter is not passed any value, but will be invoked after the update code has executed. |
|
DataCheck.GetExValue |
Parameters Property |
This method will
search the page for an Extended Data grid. If it finds one, it will retrieve
the value for the supplied property.
If no grid can be found, it will return a blank string. The parameter, property, refers to the field name
that has been configured. For example: cValue1 would represent the first
string field that you can configure. Using Note: This method will return an empty string if no grid can be found. |
|
DataCheck.GetExName |
Parameters Property |
This method will search the page for an Extended Data grid. If it finds one, it will retrieve the user configured name for the supplied property. The parameter, property, refers to the field name that has been configured. For example: cValue1 would represent the first string field that you can configure. Using our sample data set, invoking this function while supplying cValue1 against the Facilities page would return the string ‘K4612’ Note: This method will return an empty string if no grid can be found. |
|
DataCheck.IsExEnabled |
Parameters None |
This method will search the page for an Extended Data grid. If it finds one, it will return whether or not the grid is enabled or disabled. Note: This method will return ‘false’ if no grid can be found. |
|
System Methods |
|
|
|
$.trim |
Parameters Value |
This method accepts a string ‘Value’ and returns a trimmed version of the string. Trimming a string means removing any surrounding spaces from the start and end. Note: This method will return an empty string if the supplied parameter is null or undefined. |
|
pass |
Parameters None |
This method tells the data check that it has successfully passed validation. Note: Be sure to invoke “return” after calling this function to ensure no more processing happening. |
|
fail |
Parameters None |
This method tells the data check that it has failed validation. Note: Be sure to invoke “return” after calling this function to ensure no more processing happening. |
Related Topics