This node allows you to process data by creating your own Visual Basic Script code. The Visual Basic Script code is executed for every row inputed into the node. You can specify new output data by defining your own columns.
- Input Data Columns section allows you to analyse what input data columns are incomming into the node. The list will show an extra field indicating the variable name assigned to each column (ie: V0,V1,V2,V3,V4,etc). The variable assignment will be the index been passed into the script code.
- Output Data Columns section allows you to create a new list of columns that will form the output data.
- Adding a Column is done by first entering the name for the new column. You then choose whether the column is a continuous or discrete type. Click on the Add button to add the new column to the end of the list. Choosing the column to be a discrete type will convert the resulting data into a string.
- Changing a Column is done by first selecting the output column, then alter the entries and finally clicking on the Change button.
- Removing a Column is done by first selecting the column and then clicking on Remove button.
- Shifting a Column is done by first selecting the column and then clicking on the Shift Up or Shift Down buttons.
- Edit Visual Basic Script Code. This button will bring up a simple edit screen for you to enter the Visual Basic Script Code for the Node.
- Text Entry box is where you enter your Visual Basic Code.
- VB Script Include File allows you to include any file which contains Visual Basic Script Code. This allows you to keep a common code base with in a single file which can be used within multiple VBScript Nodes.
- Create Default Code will create the basic code template for you to begin coding. It will create the required procedure which is called when passing in each row of input data. It will also create the code for reading in the input data and code for outputing data.
- Test Code allows you to test the entered code. It will execute the code checking for script errors. There will be no input data passed into the script so you will have to assign your own input values while testing.
- Dismiss closes the edit screen.
NOTE: Global Constants can be used within the VB Code section and also the Include File can contain the constants.
VBScript Code Essentials
- Required Subroutine - You require to have a subroutine defined as ProcessRow(ByVal RowNum, ByVal NoRows) which is called once for every row that is passed into the node. The argument RowNum gives the current index of the row passed beginning with the zero index (ie: 0,1,2,3,4,...n-1). The NoRows argument remains the same value for every row and is the number of rows that will be proccessed (ie: n).
- Added Functionality (io object)
- io.InputSize - will give the number of input columns.
- io.OutputSize - will give the number of output columns.
- io.GetInVal(index, variable) - will get the input value into variable for the index column. Note that the index values start from zero.
- io.SetOutVal(index, variable) - will set the output value from variable for the index column. Note that the index values start from zero.
- io.ClearIgnoreRow - will signify you wish to clear the ignore row and the current rows output values will be passed out of the node. This is the default action.
- io.SetIgnoreRow - will signify you wish to ignore the current row. When this is set NO output row will be passed out of the node.
- variable = io.IgnoreRow - will return True/False whether the ignore row flag is set or not.
- Hash Functions - allow you to store data values within memory so that you can retrieve the data values between subsequent executions of the script.
- variable = InsertHash(keyin, recordin) - will insert a hash item into memory. The variable will contain a True value if succesful or False value if it failed. The keyin argument must be a string and recordin argument is a variant so can store any data type.
- variable = FindHash(keyin, recordout) - will find and retrieve the stored hash item. The variable will contain a True value if succesful or False value if it failed. The keyin argument must be a string and recordout argument will contain the returned data for the hash item.
- variable = DeleteHash(keyin) - will find and delete the stored hash item. The variable will contain a True value if succesful or False value if it failed. The keyin argument must be a string.
NOTE: To be able to execute Visual Basic Scripts you require to have Internet Explorer V5.x or later installed. This installs the required libraries for executing Visual Basic Scripts. If you do not have Internet Explorer installed then you require to download the Visual Basic Script runtime libraries from the Microsoft web site. Download and install "Windows Scripting 5.1" libraries from the Microsoft web site. You can also download relevent documention on how to code using Visual Basic Script.