Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex: http://opalis.codeplex.com
A Workflow that demonstrates the use of several text related Workflow Activities
Launch the Workflow named ‘0.Setup’ by using Start or by running it using the Testing Console.
The Workflow will create a sample input.txt file on your C: drive. The sample input.txt file will be used by the other Workflows and has following content:
1 2 3 4
1 2 3 4
This Workflow uses the Custom Start Activity to obtain input data using a parameter:
The provided value is evaluated so that the Workflow branches accordingly. This is accomplished by using Link Conditions that are configured in the Link properties:
The Read Line Activity reads all lines from the sample text file ‘input.txt’:
The Send Platform Event Activity is used to display the resulting output:
For each line that is read by the Read Line Activity a corresponding Event is sent by the Send Platform Event.
The Get Lines Activity reads all lines from the sample text file ‘input.txt’. Instead of returning the read lines one by one, it returns the read lines all at once:
The Activity will send one Event containing all the lines read by the Get Lines Activity.
The Find Text Activity is used to search the sample text file ‘input.txt’ using a regular expression:
The regular expression ‘.*[^r^n]’ reads all characters but excludes ‘carriage return’ and ‘new line’ control characters. In this example, the regular expression will return the contents of all four lines.
The Activity will send four Events containing the result from the regular expression used in the Find Text Activity.
Launch the Workflow by starting it from the Operator Console or by running it using the Testing Console. When prompted, enter the appropriate value:
Check the Operator Console Event screen or the Workflow Testing Console log to see the resulting output.
Refer to the Online Help for the Read line, Get Lines and Find Text Activities.