Back to Index |

Creating a Sequence Job in Code

Sequence jobs in code are BlueSky Integration jobs that employ the Code object to give you ultimate flexibility over calling jobs and writing complex logic around them. The Code object serves two major purposes in BlueSky Integration Studio. First, it gives you the capability to batch other jobs together into a single job and, if necessary, write logic around the jobs to control how and when they are executed. Second, it serves as a wrapper function where you can write your own custom code that you want executed as part of the job or within a Job Sequence.

For those who need low-level, complex control over the calling of your jobs, you can create a design with nothing more than a Code object on the designer window, or you can design an entire process and run the Code when the process starts or finishes, you can also embed Code object within a Sequence job. The Code object will also auto-generate the code necessary to run other BlueSky Integration Studio Server executable jobs. If you want additional logic, simply code it right into the code window. For instance, say you have 3 jobs built and compiled and you want to run those processes in a single process stream. You also need to write some code to, say check a date flag from a remote database. You can do this, and anything else you need simply by coding standard VB.NET code.

To create a Code object, simply drag and drop it onto the designer window. Then, select View-Properties (or press F4) to get to the properties window. The two properties to pay close attention to are the Code property and the RunWhen property. The code property is an extended property (has an ellipse button). Click on the Ellipse button to open the underlying code window.

The first thing you will notice is that a single line of code is already added to the Code function. Prc is an instance of the CRProcess class, which is a class that will get generated as part of your job. When you Add Job's to this function, it will use the Prc instance to run each of the jobs. You have two important buttons in the header, one is for quick access to the CodeStore administrator so that you can define new functions, or reference existing functions quickly while coding. Next, is the Add Job button. The Add Job button will allow you to select the job to run and it will automatically generate the code necessary to run the selected job.

Place the cursor where you want to insert the code to run a job and click the Add Job button:

Select the job that you want to run in the batch code process, and select the Run Type. Wait for Completion will run the job and the process will not continue on until the job has completed. The Do no wait option, will run the job and continue on. For instance, if you have 2 jobs and the first job is set to Do not wait, the process will run the first job and then immediately run the second job.

Click OK.

BlueSky Integration Studio will contact the server and pull in all the necessary information to run the selected job and generate the code block for you. You can leave it as is, or change it anyway you would like. Given that it is referencing the selected job directly, do not change the parameters in the New CRProcess instance creation line or the CRProcess class will not be able to find the job on the server.

You can continue to add as many jobs as you need to complete your entire process stream. And because this is standard VB.NET code you can also write any additional logic you need giving you complete flexibility to automate your entire process.

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