How to Use Custom Logic (Script)
Use this feature (component) to perform any type of processing that is specified by a script.
- 
                                                    
You can write your script, to perform any document content and metadata operations, using C# or VB.NET.
 - 
                                                    
This feature stores information, extracts additional metadata, uses external data sources like databases, and so on.
 
Both the input and output properties depend on the script.
- Make sure that you have specified the URL.
 - Add the component.
 - Existing Components: Click the named link for this component to see the Configuration section:

 - 
                                                    
To use the scripting pane, click the
 icon to open the script settings window.
                     - Compile: Click Compile to compile your script.
 - 
                                                    
To configure:
- 
                                                            
C#/VB: Use the default C# or select VB scripting.
 - 
                                                            
Change default script to generate a relative path and file name. Optional.
- 
                                                                    
Input Properties: Based on configuration.
 - 
                                                                    
Output Properties: Based on configuration.
You can write scripts for features and in multiple places for AutoClassifier. However, the script editor usage is the same for each location.Note: For this reason, although the scripting UI is different for features, the code examples are the same examples that are used in the Configure triggers using scripts section above. 
 - 
                                                                    
 
 - 
                                                            
 - 
                                                    
Add the component using the Add Components as Pipelines topic.
 - To reset the partition size, go to Configuration > Profiling > Binary Data Extraction. Optional.
 - Existing Components: Click the named link for this component to see the Configuration section:

 - Type in the script.
 - Compile: Click to verify the validity of the script.
 
- See the following scripting examples:
 
Scripting Examples
Item Property: GET
To get an item property, use the generic GET method on item object:
string propertyValue = item.Get<string>("propertyName");
                                                Dim propertyValue As String = item.[Get](Of String)("propertyName")
                                                Property Values: SET
Property values can be changed in a similar way by the generic SET method:
item.Set<string>("propertyName", "propertyValue");
                                                item.[Set](Of String)("propertyName", "propertyValue")
                                                Note: If you want to generate / handle multi-valued metadata via scripting, it is recommended to use List in favor of Array.
List<T> should be the type used for multi-valued metadata.
Item Raw Data
Item raw data: Raw data can be retrieved as a byte buffer using the RawData property.
        
byte[] content = item.RawData;
Dim content As Byte() = item.RawData
Log Entries
- 
                                                    
Logging: Use static methods to write entries into the log at different levels:
 
Log.Debug("Debug message");
Log.Info("Info message");
Log.Warning("Warning message");
Log.Error("Error message");
                                                    
Log.Debug("Debug message");
Log.Info("Info message");
Log.Warning("Warning message");
Log.[Error]("Error message");
                                                    How to Define Assemblies and Namespaces to Import
- 
                                                    
Click the
 icon to define the namespaces to use.
         - 
                                                    
Add all the Assemblies (DLL files) you wish use in your scripts to the \Config\ScriptingAssemblies folder from your AutoClassifier Engine install folder.
 - 
                                                    
For example: C:\Programs\BAI AutoClassifier\Admin Site\AutoClassifier\Config\ScriptingAssemblies
 
Note: If you upgrade from a version earlier than 6.1.0.0 - 18995 you must copy to \Config\ScriptingAssemblies all the previously referenced assemblies in your scripts and triggers.
- 
                                                    
For all the namespaces you want to use, add them in the pop-up text box separated by New Line character.
 
Example:
System.Text.RegularExpressions
System.Text
System.Linq
System.Collections.Generic
Newtonsoft.Json