The global variables script class contains all global variables that are used within the solution. These data definitions are exposed so that you can use them within custom code, and also so that the you can see the definition of the custom structures and arrays as a point of reference.
In addition to global variables, this script class also houses a series of common functions and subroutines used throughout the solution. You can use these common functions within custom code placed on the user exit script class, or within code for any additional classes that are created.
The common functions, along with a description of their potential uses, are described in the following table.
Name of function / sub-routine | Description |
---|---|
ReadSettings | This function reads the system configuration INI file. |
DicVal | This function returns the value of any parameter contained within the
system configuration INI file. The function parameters are as follows. strKey This is the name of the INI file parameter. strDic This is the name of the INI section in which the parameter is held. Neither strKey nor strDic are case-sensitive. For example, if the EXP_VL_OutputDateFormat configuration parameter contains MMDDYYYY, then the following command copies MMDDYYYY into the strOutputDateFormat local string variable. strOutputDateFormat = DicVal("OutputDateFormat", "EXP") For configuration parameters that have a Boolean type of OP, the function only returns a value of Yes or No. |
Parse_INIVal_Yes | This function receives an INI file strVal parameter value that has been entered against a parameter with Boolean type OP, and determines whether the value is interpreted as Yes or No. |
SplitString | This subroutine performs a split on a given string based on a nominated
separator, and returns the components of the string back to the calling
function in an array, along with the number of values in the array. The interface parameters are as follows. strSource This is the input string to be split. strSplitArray This is the array containing the split results passed back to the calling module. strDesignator This is the delimiter to be used when performing the split. ArrayLineCount This is the number of array elements in the returned strSplitArray. For example usage, Dim myString As String Dim Words() As String Dim intWordCount As Integer myString = "MARY HAD A LITTLE LAMB" A space is set as the delimiter. Call SplitString(myString, Words(), " ", intWordCount) The returned Words array would contain the following. Words(1) = "MARY" Words(2) = "HAD" Words(3) = "A" Words(4) = "LITTLE" Words(5) = "LAMB" The returned intWordCount parameter would be set to 5. |
fnConvertToExternal | This function converts a date in the date format used internally, for
example DD/MM/YYYY, into a specified format. The interface parameters are as follows. strDate This is the date to be formatted. strFormat This is the format of date, either MMDDYYYY or YYYYMMDD. Any other entry returns DDMMYYYY. strSeparator This is the separator to be used when converting the date. For example, Dim myDate as string myDate = "12/08/2009" 12th August 2009 myDate = fnConvertToExternal(myDate, "MMDDYYYY", "-") The value of myDate is set as 08-12-2009. |
fnConvertToInternal | This function is used to convert a date with a specified format into the
date format used internally within Brainware for Transcripts, such as
DD/MM/YYYY. The interface is as follows. strDate The date to be formatted to DD/MM/YYYY. strFormat The current format of strDate (either YYYYMMDD, MMDDYYYY - any other entry returns DDMMYYYY. strSeparator The separator currently used in strDate. For example, Dim myDate as String myDate = "2009-08-12" 12th August 2009 myDate = fnConvertToInternal(myDate, "YYYYMMDD", "-") The value of myDate is now set to 12/08/2009. |
fnFormatDateForExport | This function converts a date in the Verifier output format, as configured
in the DAT section of the system configuration, into a date in the export
output format, as configured in the EXP section. For example, date can appear in any format, but the system converts it to the format specified in the DAT section. If that format is MMDDYYYY, 12 th August 2009 is displayed in Verifier as 08/12/2009, which is also the technical content of the field object text property. For example, the contents of pField.Text or pWorkdoc.Fields("MyDate").Text). fnFormatDateForExport takes the technical contents of the field and converts it into the date format as specified in the EXP section. If the export format is YYYYMMDD with a hyphen (-) as the separator, then the following command populates the strDate string variable with 2009-08-12. strDate This is the fnFormatDateForExport(pWorkdoc.Fields("MyDate").Text) The interface of the function is as follows. strDate This is the date to be converted. |
fnWriteXMLField | This function writes a single line into the XML file, and is intended for
use within UserExitXMLOutput and provides a mechanism to add a custom field
into the XML file with a single command. The interface of the function is as follows. strAttribute = name of the configuration parameter containing the tag for the XML field. strValue = value of the field to be outputted. For example, in the configuration database, a new parameter called EXP_VL_XMLHCTranscriptCode has been created with a value of TCODE, and a new field has been created against the Transcript class in the TranscriptCode project which contains the extracted value of 12345, and this value is written to the document header section of the XML file. This can be achieved by placing the following in the UserExitXMLOutput framework. Select Case strSection Case cDefaultXMLDocHeader fnWriteXMLField("TranscriptCode", pWorkdoc.Fields("TranscriptCode").Text) Case cDefaultXMLStudentHeader … End Select This writes the following line into the document header section of the XML file. <TCODE>12345</TCODE> The function is deprecated. It is replaced by fnInsertXMLNode. |
fnWriteXMLDateField | This function is used to write out a date field to the XML file where the
date to be written is in the Verifier output date format specified in the DAT
section of the system configuration. As well as writing the value into the XML
file, the system converts the date passed into the date export format as
specified in the EXP section of the system configuration. The interface and function usage is identical to that of fnWriteXMLField as described above. The function is deprecated. It is replaced by fnInsertXMLNode. |
fnGetFileName | This simple function receives a full filename, which includes the file
path and file extension, and returns the name of the file itself. For example, if c:\My Documents\12345.tif is passed to the function, the output is 12345. Interface is strFileName |
fnGetBaseClass | This simple function returns the base class associated with the class
passed to the function. If a base class is passed to the function, the same
base class is returned. For example, if the function receives College and that class is a child class of Transcripts, the function returns Transcripts. Interface is strClass |
fnIsVerifier | This function returns a Boolean value of True if the current Intelligent Capture Module executing the script is the Verifier Module. |
fnGetBatchID | This function receives the path to a document in the batch directory
(strWorkfile), parses the file path, and returns the batch ID number as a
string. Interface is strWorkfile |
fnIsAlpha | This function returns a Boolean value of True if the string passed in the
strString parameter is composed entirely of alpha characters (upper or lower
case). Interface is strString |
fnGetUserDecimalSeparator | This function reads the local Windows settings for the user logged onto the machine and returns either a full stop/period or a comma depending on the decimal separator preferences. |
fnSetDBConnection | This function can be called from a user exit in order to connect to a
database. The function takes in a database connection string using the input strConnection parameter. If the connection is already available, the index of the connection in global database connection array objDBConn is returned; if it is not available or not open, the function initializes the connection and return the relevant index of the objDBConn object. If the connection cannot be made, the function returns -1 and an appropriate error message is written into the standard Brainware for Transcripts log file. For example, the following code instantiates a database connection and execute an SQL call where variable myDBConnection represent the connection string, and mySQL represents the SQL statement (both string variables). Dim lngConnection As Long Dim myConnection As ADODB.Connection lngConnection = fnSetDBConnection(myDBConnection) If lngConnection = -1 Then ' Connection could not be made - error handling Else ' Execute SQL using connection Set myConnection = objDBConn(lngConnection) myConnection.Execute(mySQL) End If objDBConn is a global database object available for use in any user exit. Interface is strDBConnection |
fnMatchDBComponents | This is a supporting function used by fnSetDBConnection. |
fnCheckDBArray | Utility function that checks to see whether a passed database connection
array of type ADODB.Connection is initialized. If it is not, the function
initializes it. Interface is myArray() |
fnExtractDBComponents | This is a supporting function used by fnSetDBConnection. |
fnGetFieldAnalysisSettings | This function returns an instantiated AnalysisSettings object for given
associative search engine field oASSA and document class strClass. Interface is strClass, oASSA |
fnIsValueInList | This function takes a comma-separated list in strList input parameter and
a value strValuePreserve. The function returns a Boolean true value if
strValuePreserve is one of the values in the list. Interface is strList, strValuePreserve |
fnConvertToDouble | This utility function takes in a string strString and converts it to a
double value in a way that is consistent with the locale settings of the
machine. If the string cannot be converted, the output is zero. Interface is strString |
fnIsNumeric | This utility function returns a Boolean true value if all characters
passed in the strTemp input parameter are numeric (For example, 0-9).
Interface is strTemp |
fnCheckForNull | This function receives a field component of a database record set and
returns the value as a string to the calling routine using the function name.
If the field component has a null value, an empty string is returned.
Interface is strString |
fnConvertBoolean | This function receives a Boolean field component from a database record
set and returns Yes if the value is positive (and No if the value is negative)
back to the calling routine using the following function name. Interface is blBool |
fnSetFromFileName | This function takes the same of a parameter is the IMP section of the INI
file, along with the document filename, and parses out the corresponding value
from the filename passing it back to the calling routine using the function
name. If the field is a date, it is formatted in accordance with the VerifierOutputFormat setting in the DAT table. Interface is strFieldName, strFile |
RedimClientGlobals | This function takes the global client buffer array and initializes it if it has not already been done. |
RedimFSGlobals | This function takes the global field settings buffer array and initializes it if it has not already been done. |
fnGetClientData | This function receives a client ID and returns its corresponding settings
from table Client using the ClientData structure. For example, to retrieve details for client zero, use the following. Dim Client As ClientData Client = fnGetClientData("0") Interface is strClientID |
fnGetClientDataForWorkdoc | This function receives a workdoc object and returns the client settings
configured in table Client that are associated with that workdoc using the
ClientData structure. For example, Dim Client As ClientData Client = fnGetClientDataForWorkdoc(pWorkdoc) Interface is pWorkdoc |
fnGetFieldSettings | Function to retrieve the field settings from the BRWFLD table for a given
combination of field name, document type and profile ID. The settings are
passed back using the FieldSettings structure. For example, to retrieve settings for the course number and document type associated with profile ID 1, use the following. Dim FS as FieldSettings FS = fnGetFieldSettings("COURSE NUMBER","COLLEGE", "1") Interface is strFieldName, strDocumentType, strProfileID |
fnReadSubRule | This function receives a substitution rule ID as a string and populates
the SubRule object with the rule details, which is then passed back to the
calling routine with the function name. Interface is strRule |
fnGetValueForIR | This function receives the text for an invalid reason as displayed in the
field in Verifier with the strIR parameter and returns a corresponding property
(specified by strValue) belonging to that rule back to the calling routine with
the function name. Possible values for strValue are RULE and EXPORTCODE. Interface is strValue, strIR |
RedimCountryGlobals | This function takes the global country buffer array and initializes it if it has not already been done. |
fnInsertXMLNode | This function inserts a child node to the specified parent node. If there
are multiple parent nodes, a child node is inserted to each parent node. It is
intended for use withing UserExitXMLDoc and provides a mechanism to add a
custom field into the XML file. The interface of the function is as follows. xmlDoc = the output XML document parentName = tag name of the parent node newNodeName = tag name of the inserting node newNodeValue = text value of the inserting node duplicateAllowed = flag to allow duplicate nodes or not For example, in the configuration database, a new parameter called EXP_VL_XMLHCTranscriptCode has been created with a value of TCODE, and a new field has been created against the Transcript class in the TranscriptCode project which contains the extracted value of 12345, and this value is written to the student header section of the XML file. This can be achieved by placing the following in the UserExitXMLDoc framework. fnInsertXMLNode(xmlDoc, "studentRecord", "TranscriptCode", pWorkdoc.Fields("TranscriptCode").Text, False) This writes the following line into the student header section of the XML file. <TCODE>12345</TCODE> |