Click the Extracted Fields option to enter a list of fields that ThinkAutomation will extract from messages that match the Trigger Conditions.
For each Trigger you can specify any number of 'Fields'. A Field is a distinct piece of data that ThinkAutomation will extract from the message and assign it a 'Field Name'.
Note: For Email messages, ThinkAutomation will also scan and parse any text, PDF, Word or XML attachments in addition to the body text.
Once all fields have been extracted ThinkAutomation can update your database and perform other Actions.
To create a new field click the Add Field button.
Before creating any fields it is a good idea to paste a copy of the message subject and body you are extracting data from into the Find & Extract Helper boxes. ThinkAutomation will then highlight the data it will extract for each field as you specify the extraction properties. The message Subject and body will be saved with the Trigger - so you only need to paste it once. If the Helper text is blank ThinkAutomation will update it when the first message for the Trigger is processed.
Enter a Name for the field.
In the Find Field section you specify how ThinkAutomation will find the field from the message.
Start From Last Extract Point
Normally ThinkAutomation moves the 'extraction point' as it moves through the message extracting data. Disable this option if you want ThinkAutomation to start from the beginning of the message when it looks for this field. Once a field is extracted the extraction point will be set to the end of the field. The next field extraction starts from this point unless you disable this option.
Check Subject Line Only
Normally ThinkAutomation checks both the subject line and message text. Enable this option if you want ThinkAutomation to only check the subject line text when it looks for this field.
By default ThinkAutomation ignores case when it looks for fields. So 'order number' and 'Order Number' with both match when searching for 'Order number'. Enable this option if you want to perform a case sensitive search.
Is Repeating Block
This option sets the field as a 'repeating block'. If set ThinkAutomation will enter a loop and repeat the extraction of this field until it finds the next field to extract (or the end of the message). See: Repeating Blocks for more information.
Enter the text that ThinkAutomation should look for when searching the message for this field. This should be the text that is the same for each mail and uniquely identifies the field.
Then Look For
Enter an additional text string that ThinkAutomation looks for AFTER it has found the above text. This is optional but is useful when data is formatted in the message using an unknown number of TABS or spaces. Consider the following
Customer code : ABC
We would search for 'Customer code' and then ':' because we don't know how many spaces are between 'Customer code' and ':'. The field extraction would then start after the ':'.
In both the 'Look For' and 'Then Look For' entries you can make use of Regular Expressions to assist with searching.
In both the Look For and Then Look For fields you can include a number of control characters in addition to regular expressions:
Carriage return/line feed
When used on its own the * character finds the next non-space or non-control character.
Where xxx is the ASCII character code
This can be useful when searching for data. For example, suppose the text contains:
Your serial number is:
We want to extract the serial number, so we could look for 'Your serial number is:' and then look for '<CRLF>' - because the serial number is on the next line. Another way of doing the above would be to look for 'Your serial number is:' and then look for '*' - which would effectively look for any none control character or space after 'Your serial number is:'.
Click the Extract Data tab to define how ThinkAutomation will extract data for this field once it has found it.
There are a number of options you can use to extract data from the message (all options start the extraction after the 'Look For', and optionally 'Then Look For' text):
Until End Of Line
Extract all data up to the end of the line (or the end of the message if there are no more lines).
Until End Of Message
Extract all data up to the end of the message.
Until Any Of These Characters
Extract data until any of the following characters are found. You can then specify a list of characters to search for. If any one of the characters are found then extracting will stop.
Until These Characters
Extract data until specific words or characters are found. You can then specify characters, words or phases to search for. Extraction will stop when the words are found. Regular expressions permitted.
Until These Many Characters
You can manually specify a number of characters to extract.
Until End Tag
Select this option if you are extracting HTML or XML tags. If the 'Look For' value is a tag, for example: <mytag> then ThinkAutomation will extract up to the end tag </mytag>. This option will be automatically selected on new fields if you enter a tag in the 'Look For' entry.
Use The Find Mask
Select this option to extract the field INCLUDING the 'Find' mask. This is useful when you want to find AND extract using a regular expression. The data would be extracted starting from the 'Find' value. For example, if the 'Look For' is set to the regular expression: "[a-zA-Z0-9._-]+@[a-zA-Z0-9_-]+\.[a-zA-Z.]+" (which is the regular expression for an email address) and the 'Use The Find Mask' option is selected.. then the first Email address will be found AND extracted. If the 'Use The Find Mask' is not selected then the first email address will be found and extraction will start AFTER the end of the email address.
Clean And Trim Blanks
Enable this option if you want the extracted data to be cleaned and trimmed. This will remove any leading or trailing spaces, tabs or carriage return/line feed/control characters from the field data.
You can also select to remove a number of characters from the beginning and end of the extracted data.
You can select the type of field from this drop down menu. If you know the data is always numeric, for example, then select 'Numeric', otherwise leave as 'String'.
Enable this option if you want to write a custom ThinkAutomation Basic script to extract the field data from the message. This gives complete control over how you extract the field. You can also access all the Headers from the message. See: Field Extraction Scripts
Select the Attributes tab to define optional additional attributes for the field.
Enter a value that will be assigned to the field if no data is found or extracted from the message text.
This option allows you to change the extracted value to UPPER CASE or to apply Word Capitalization.
In this section you can define validation rules for the extracted field and you can define what action ThinkAutomation should take if the extracted data is invalid.
Select the Validate option to enable validation for this field. Select Cannot Be Blank Or Zero option if the field must be a value (or be non-zero in the case of numeric fields). For numeric fields you can also select a valid Numeric Range. The Must Be In List option allows you to define a list of valid values. In the Choices entry specify the list of valid values for the field. Separate each value with a | (pipe) character. For example, if the field must be Y or N - specify 'Y|N'
If Data Is Invalid
Here you specify what ThinkAutomation should do if the extracted field data is invalid. There are two options:
1. Set Field To Default Value - select this option if you want ThinkAutomation to replace the extracted data with the field's default value (or blank if no default it specified).
2. Cancel Trigger - select this option if you want ThinkAutomation to cancel execution of the trigger for the current message.
Mapping To Database Fields
Select the Database Field tab to map the extracted field to a field in your database that you want ThinkAutomation to update.
Enter the Table Name that the field will be updated on. This table must already exist in your database. Multiple fields can use different table names if required - but the tables must be part of the same database.
Enter the Database Field Name in the table that the ThinkAutomation field will be mapped to.
Max Field Length
You can optionally specify the maximum allowed field length for the database field. ThinkAutomation will truncate the field before updating the database if the extracted data is greater than the maximum length. Use this option to avoid database errors that will be raised when field data is inserted into your database that is greater than the defined length. This option applies to String field types only. Set to zero if you do not want ThinkAutomation to truncate the field.
Check this box if this field is a Key Field. Key fields allow you to control how your database is updated. If you create one or more key fields, ThinkAutomation will first check if a record exists in your database using the key field values. If a record already exists then the existing record will be UPDATED otherwise a new record will be INSERTED.
ThinkAutomation can also set environment variables as fields are extracted. This is useful if one of the Actions you are using is 'Run Process'. ThinkAutomation will set the environment variable to the value of the field before the process is run. Your external process can then read the environment variables and act on them.
Select the Pass To tab if you want to pass the extracted field value to another trigger for further processing. This is useful for complex messages, allowing you to break up processing.
Select the Trigger to pass the field data to from the drop down list.
If you use this option, ThinkAutomation will extract the field data as normal. It will then use the extracted field value as the message body text of a new message and pass it to the selected trigger. This trigger will execute independently as if it had received a new message. The headers of the passed message will be set to the headers of the original.
By default the Subject of the pass to message will be set to the subject of the original message. You can change the subject line in the Set Subject To entry.
The Body of the message will be set to the value of the extracted field. You can change this in the Set Body Text To entry. The %fieldvalue% placeholder contains the value of the current extracted field. You can enter any other text and use previously extracted field values.
Order No: %orderno%
Would pass the previously extracted field 'OrderNo' along with a blank line and then the current extracted field. The Trigger that receives this message can then extract both values just like any other incoming message.
See Also: Repeating Blocks
See Also: Lookup Fields