Community articleCheckDataValidity function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This function tests the validity of the data in an XForms model. By default, the following aspects of XForms validity are analyzed:
  • XML schema validity
  • validity of the type Model Item Property (MIP)
  • xsi:type validity
  • XForms constraints
  • the required but empty condition
CheckDataValidity can only be used when XForms processing is turned on. You cannot use this function on a form that has been opened using the ReadForm function with either the UFL_SERVER_SPEED_FLAGS flag or the UFL_XFORMS_OFF flag; use the 0 flag or the UFL_SERVER_SPEED_FLAGS_WITH_XFORMS flag to keep XForms processing turned on.

Function

Function CheckDataValidity(
      validityFlags as Long,
      modelID as String,
      dataRef as String,
      listOfFailures as String()
      ) As Boolean


Parameters

Table 1. Function parameters
ExpressionTypeDescription
validityFlagsLongSpecifies the behavior of the function. Must be one of the following values:
0 — Analyzes all relevant nodes as specified by modelID and dataRef parameters.
UFL_IGNORE_RELEVANCE — Analyzes all nodes, including nodes that are not relevant.
UFL_STOP_ON_FIRST_INVALID — Returns when the first failure is found.
UFL_IGNORE_MODEL_UPDATES — Ignores the flags that mark a model for a deferred update, and analyzes the data without updating the XForms model.
modelIDStringThe ID of the model that will be analyzed. If null or empty, the default model is analyzed.
dataRefStringAn XPath expression that specifies the nodeset that will be analyzed. If null or empty, all instances in the model are analyzed.
listOfFailures
Contains a list of XPath expressions when the method returns. Each expression indicates a node that did not pass the validation test.
This parameter can also be null. If null, the function returns when the first failure is found.


Returns

True if all nodes that were checked are valid, False if at least one node fails one or more of the validity tests.

Notes

This function does not test for out-of-range conditions on xforms:select, xforms:select1, and xforms:range.
In an XForms model that has been flagged for update, the default behaviour of CheckDataValidity is to xformsrebuild API 801 COMCreate New Article, xformsrecalculate API 801 COMCreate New Article, and xformsrevalidate API 801 COMCreate New Article the model before analyzing the data.
Parent topic:
FormNodeP functions