Back to Index |

Reading and Writing Parameters in code

There are many times where you may want to read and write job parameter values from within a BlueSky Integration Studio job. For instance; if you need to set the Filename to process, or calculate a date to use for a specific job.

Below are code examples of how to read and write parameters from within a BlueSky Integration Studio job. This can be done in any of the code behind windows of a job (PreJobCode, PostJobCode, etc...)

How to read the value of a job parameter:

Dim p As CRParameter
Dim i As Integer
Dim MyParameterValue As String
i = CRParam.Parameters.IndexOf("MYPARAMETER")
p = CRParam.Parameters.Item(i)
MyParameterValue = p.pValue

The MyParameterValue variable now holds the value of the MYPARAMETER parameter.

How to write the value of a job parameter

Function: SetParameterValue(<parameter name>, <parameter value>)
SetParameterValue("MYPARAMETER", "01/31/2006")
CRParam.LoadParameterList() ' reloads the parameters back into memory from the parameter file in the repository

How to read the parameters file of a job, loop through its values array, and log them to the job log for reference and debug purposes.

Dim pColl As CRParametersCollection
Dim param As CRParameter
Dim MsgString As String
Dim NL As String = Chr(13) + Chr(10) ' New line
' Get the collection of parameters
pColl = GetParameters()
MsgString = "Current Parameter Values:" + NL + NL
If Not (pColl Is Nothing) Then
' Create a message string
For Each param In pColl
MsgString = MsgString + "Parameter " + param.pName + " set to: " + param.pValue + NL
Next
' log the message string to the event log
le.AddLogEvent("YourJobName", CRLogEvent.LogEventTypes.Informational, MsgString)
le.ManualFlush()
End If

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