Depending on your needs, you should define some or all of the following class methods in your data type classes:
-
IsValid() — performs validation of data for the property, using property parameters if appropriate. As noted earlier, the %ValidateObject() instance method of any object class invokes the IsValid() method for each property. This method has the following signature:
ClassMethod IsValid(%val) As %Status
Where %val is the value to be validated. This method should return an error status if the value is invalid and should otherwise return $$$OK.
Note:
It is standard practice in InterSystems IRIS not to invoke validation logic for null values.
-
Normalize() — converts the data for the property into a standard form or format. The %NormalizeObject() instance method of any object class invokes the Normalize() method for each property. This method has the following signature:
ClassMethod Normalize(%val) As Type
Where %val is the value to be validated and Type is a suitable type class.
-
DisplayToLogical() — converts a display value into a logical value. (For information on formats, see Data Formats.) This method has the following signature:
ClassMethod DisplayToLogical(%val) As Type
Where %val is the value to be converted and Type is a suitable type class.
The other format conversion methods have the same general form.
-
LogicalToDisplay() — converts a logical value to a display value.
-
LogicalToOdbc() — converts a logical value into an ODBC value.
Note that the ODBC value must be consistent with the ODBC type specified by the OdbcType class keyword of the data type class.
-
LogicalToStorage() — converts a logical value into a storage value.
-
LogicalToXSD() — converts a logical value into the appropriate SOAP-encoded value.
-
OdbcToLogical() — converts an ODBC value into a logical value.
-
StorageToLogical() — converts a database storage value into a logical value.
-
XSDToLogical() — converts a SOAP-encoded value into a logical value.
Important:
All these methods are class methods and all of them must accept an argument: the value to check for validity, to normalize, to convert, and so on.
Note:
Note that the data format and translation methods cannot include embedded SQL. If you need to call embedded SQL within this logic, then you can place the embedded SQL in a separate routine, and the method can call this routine.