Defining regular expression in the XML file
In Sterling Business Center all the data types which has to be validated against a specific regular expressions are defined in the sbc_datatypeValidationRules.xml file.
For example, a regular expression for an open form field in the sbc_datatypeValidationRules.xml file is defined in the following format:
<DataTypes> <DataType Name="FreeText-40" Prefix="openform_"> <Validation> <Regex ref="open-text-param-value-pattern " /> </Validation> </DataType> </DataTypes>
- All the data types are initialized as part of application initialization in the AppcommonInitServlet for Sterling Business Center. This servlet reads the sbc_datatypeValidationRules.xml and creates new data types, copies the default data type properties like size, min, max values and so on from the original Data type with its name as Name attribute value (datatypeName) and adds a regular expression to the newly created datatype.
- The AppcommonInitServlet reads all the context parameters whose name starts with appcommon-openform-datatype-list and loads the XML file. The sequence in which the XML files are loaded is determined by the load order; the XML file having the least load order, is loaded first. For example, if two context parameters has name starting with appcommon-openform-datatype-list, and the load order of the two context parameters is 300 and 500, respectively, the XML file with the load order of 300 is loaded first.
- Whenever a new open form field is created, the scuiDataType should be defined in prefix_datatypeName format and a new entry has to be added to sbc_datatypeValidationRules.xml.