Back to Index

 

Global Variables and Objects

Sometimes it is necessary to keep some data around for the life of a BlueSky Integration Studio Job.  Or, you may want to call out to a custom class object and use its functions in your job.  You can define global variables and objects at the job level by inserting your code into the GlobalJobCode property.   

Double-click anywhere on the designer window of your job (not on an object, the designer window's background)  to get the job level properties.  The click the ellipse button (...) next to the GlobalJobCode property to get to the coding window.

Some examples of why you might need to use global variables or objects in a job.

Here is an an example:

There are 2 areas to insert your code.  

First, you must declare your variables.  This code will be inserted into the final class code for your job at compile time.   You must declare your variables as Shared as shown above so that they will be shared across all classes within your job.  If you attempt to use these variables throughout your job and they are not declared as Shared, then you will get the compiler error: Reference to a non-shared member requires an object reference.

Next, you can insert code directly into the job constructor (New) function to create and/or initialize your objects.

That's it!  Now you can reference these variables and objects throughout the life of your job, at any time!

For example, let's assume one of your columns data is a number that represents the day, however you want the actual text, or day name.  As seen above we can simply create a little lookup table (Hashtable) in memory and replace the numeric day numbers with the actual day name as each record is read in.  You would probably enter some code into your column code behind window similar to this:

Dim dayName As String

 

dayName = dayLookup.Item(i1.DAYNUM)

 

If Not (dayName Is Nothing) Then

     Return dayName

Else

     Return "undefined"

End If

 


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