Back to Index |

Job Sequence

Folder Watcher Loop

The Folder Watcher object allows you to "watch" a directory for incoming files and process them by sending them to other BlueSky Integration Studio jobs through a parameter. For instance; in the job design below, the job is watch the Budget folder on the BlueSky Integration Studio server. When a new file arrives, it is sent via parameter to the Load Sales Budget file job and the Run Allocations job. Then, the process loops back around and looks for another file to process.

Properties

Alias | Alias identifier. Aliases are used on all design objects to simplify coding and to ensure each object has a unique identifier.
Comments | Comment area to give descriptive text about the object and its purpose.
CheckEveryXSeconds | Number of seconds to wait between each loop before checking if a new file exists in the specified folder to watch.
FolderToWatch | The file system path to watch.
IncludeSubFolders | Yes or No. Specifies whether the search algorithm should recurse through the sub-directories of the specified FolderToWatch path as well.
LoopUntil | Specifies the action to take for the looping logic.
Option | Description
FileIsFound | The Folder Watch object will continue watching the folder until it finds a file. When it finds the first file, it will process it and then stop searching and continue on with the rest of the job sequence.
FolderIsEmpty | The Folder Watch object will search for and process every file it finds in the specified FolderToWatch path until the folder is completely empty, then stop processing and continue on with the rest of the job sequence.
ManualStop | The Folder Watch object will continue searching for, and processing any file it finds until the loop is manually stopped via the user-defined code under the Loop object, or until a user manually stops the job in the Job Control window. Say for instance, you want to loop all week, but stop the process on the weekends. You could place some code in the Loop object to check if today is Saturday or Sunday and tell the process to stop. The loop object is a boolean function. To continue the loop the function should return True (the default), however to stop the loop simply return False.
MoveProcessedFileTo | Once a file has been processed, you typically don't want it to be processed again. The MoveProcessedFileTo property allows you to set a path to where you want the file moved to after processing has completed.
WildCards | The Folder Watch object allows you to specify wildcards to use in its search for files in the specified folder. For instance; if you know that only .txt files should be processed, then you can put *.txt here. If you need to limit the search to multiple file extensions, simply separate them by a comma. For instance; *.txt,*.csv
ParameterToMapFilePathTo | Somehow the Folder Watch object needs to pass the File and Path to the next object in the sequence when it finds a file so that it knows what to process. This is done through the use of Parameters. To set this up: 1. When you create the job that will read and process the file, create a parameter for that job that will be used to pass in the File name and path to that job. Use that parameter in the data objects properties to specify the file name. For instance; if you are processing Text files, then you might create a Parameter called Filename, and then set the Text file objects FilePath property to <CRP>Filename</CRP> 2. When you call the job above from a Job Sequence job, the Filename parameter will automatically be imported into the parameters for the Sequence job, assuming it was there when you selected the job. If not, simply re-select the job from the SelectJob property on the Run Job object and it will also re-import all of that jobs parameters. 3. Finally, click the Ellipse button on the Folder Watch object's ParameterToMapFilePathTo property and select the Filename parameter. When the Folder Watch object finds a file to process, it will fill the Filename parameter with the path and filename of the file it found, then call the job to process it, thereby passing in the file and path to the job via the Filename parameter.
Name | Descriptive name for this object. You can enter any text to describe the object. When a job is selected, this property is set to the job name if it has not already been set by the developer.

© 2003 - 2007 Relational Solutions, Inc. - All rights reserved