Run .Net Script
The Run .Net Script object can run
scripts written in VB.Net, JScript, C#, and Powershell.
Note: The Run .Net Script object is
compatible with v2.0 of the .Net CLR and above.
How it is used
Use the Run .Net Script object to
run scripts that parse data or run functions against APIs that you
have available.
Configuration
To configure the Run .Net Script
object you need to know the code you want to run, the libraries
that you will be using and the data that you will want to
publish.
Details Tab
Type
|
Select the language that you
will use for your script, use the ellipsis (...) button to browse for the language.
|
Script
|
Type the code that will be
executed when the object runs.
|
Advanced Tab
Namespace
|
Add a Namespace for each .Net
namespace that will be used within your code. This will allow you
to call the code without using fully-qualified names for each of
the classes. Opalis recommends adding System namespace to every Run
.Net Script object.
|
References
|
Add each of the Assembly (DLL)
references that contains the libraries that you want to use. Opalis
recommends adding the System.dll found in the
C:\Windows\Microsoft.Net\Framework\<.Net Version>
directory.
|
Published Data
Add each of the Published Data that
you want this object to publish. Every published data item that you
add will be available on the Databus. It is important to determine
whether the Published Data item will be multi-valued. The Run .Net
Script object automatically correlates multi-valued data from
different items by aligning them. For example, if you choose to
publish two items labelled “Name” and “Email” as Collections, the
Run .Net script will try to line up each item in the Name
collection with each item in the Email collection. If the
collections are not equally sized, then the Run .Net Script object
will create blank values for the collection that has fewer
items.
To configure published data
items:
1.
|
Click Add. The Published Data dialog appears.
|
2.
|
Type the Name of the published data. This will
be the Name that appears when other objects are subscribing to the
data published by the Run .Net Script object.
|
3.
|
Select the Type of the data. If the type you want
is not available, select String. Use the ToString method of the
object to assign a value to this published data.
|
4.
|
If this item of data will be
multi-valued, select Collection. When using a collection you
must use the Add method to add items to the collection. If you are
not using the collection you can use the assignment operator (“=”)
to assign the value.
|
5.
|
Type the Variable name that you will use within
your script to assign a value to this item. The Run .Net Script
object will automatically create a .Net Property for this item. If
this variable is a collection it will be created using a
List<T>, where T is the Type that you selected. If it is not
a collection the property will be created using a String, Int, or
DateTime based on the Type
that you selected. Use unique naming to make sure that your
variable name does not collide with existing variables within your
script OR classes and keywords available in .Net. Opalis recommends
prefixing variables with “OPD_”. For example, if you want to name
your variable “myString”, you would name it “OPD_myString”.
|
Available Published Data
Name
|
Description
|
Standard Error
|
Any stderr output returned by
the Run .Net Script object.
|
Namespaces
|
The namespaces used.
|
Standard Output
|
The stdout returned by the Run
.Net Script object.
|
References
|
The Assemblies used in the
object.
|
Script Body
|
The script that was run.
|
Script Language
|
The language that was selected
for the script.
|