Imports system namespaces
The namespaces are at the top of the template. They are part of the default record. These namespaces enable the VB Script to use various .NET classes.
Namespaces can be added or removed from the script. For example, you can
remove
imports Systems.Diagnostics if you do not require
tracing.
- Use
Imports Systemfor all. It has some useful things in it, such as exception class (i.e., error handling)Array,DBNull. - Use
System.Diagnosticsfor tracing. - Use
System.XMLif your script includes XML documents. System.Datacan return theADO.Net Dataset. This is used byObjMethodcommands, required for search results reports, for example.- Use
System.Text.RegularExpressionsfor string manipulations. Use regular expressions for search and replace on string values. - When you use
System.Text,use the MicrosoftStringBuilderclass as a performance-oriented alternative to simple string concatenation. This enables you to reserve the memory for the resultant string. - Use
System.Netif you plan on talking to other networked systems. For example, calling aWebServiceon another product such as making an HTTP call from the Optiva workflow toWebReportsto print a report. System.Configurationenables the script to read .Net configuration files like Web.config.System.Collectionsincludes theHashtabledefinitions andArrayListswhich are both useful for building and checking a list of objects.
In general, if you declare a name space at the top of the script, you do
not have to add prefixes in the code. For example, extended math commands live in the
System.Math namespace. With it declared, the script is:
Dim tpval as Double = Round(3.14159*2)
Otherwise, without a declaration, it is:
Dim tpval as Double = Math.Round((3.14159*2)
See the MSDN .NET Framework library.