JAMS Developer Guide
Creating a Job With Parameters

Through the JAMs Client you can graphically create Jobs. This sample will show how to easily create Jobs programmatically in C#. This sample demonstrates how to create and then add Parameters to Jobs.

Note: before you create a Job you must be connected to a JAMS server.
Connecting to your JAMS Server
Copy Code
//
// If this is run on your JAMS Server, "localhost" will work
// If you want to run this on a different machine, you have to change "localhost"
// to the name of your JAMS Server
//
Server jamSver = Server.GetServer("localhost");

First you need to instantiate the Job and set the desired properties. You must at least define a unique name ("JobName"). For a complete list of the properties you can set see the Job Class Properties documentation.

Note: If a specific folder location is defined ("ParentFolderName") the folder must already exist. If no folder is specified then the job is put into the root folder by default.
Instantiating a Job
Copy Code
Job exampleJob = new Job()
{
JobName = "Job_with_Parameters",
Description = "This is a new Job that has some Parameters",
ParentFolderName = @"\Parameters Sample",
ScheduledDate = "Monday,Wednesday",
ScheduledTime = TimeOfDay.Parse("11:30 am")
};

In order to add a Parameter to a Job you must first instantiate the Parameter and set the desired properties. You must at least define a unique name ("ParamName").  For a complete list of the properties you can set see the Parameter Class properties documentation.

Caution: Avoid using spaces in Parameter names (ParmName). Doing so will cause most types of Jobs to fail.
Note: A Job may have zero, one, or multiple Parameters.
Instantiating a Parameter
Copy Code
Param nameParamater = new Param()
{
ParamName = "Name_Input",
DataType = DataType.Text,
Length = 15,
Prompt = "enter a name",
HelpText = "enter only the first name",
Required = true
};

After a Parameter has been created you can add it to a Job. This Parameter could be assigned to different jobs by changing "exampleJob" to a different instantiated job object.

You can add multiple Parameters by repeating the line of code below. You will need to change "nameParameter" to the desired Parameter object that has already been instantiated.
Assigning a Parameter to a Job
Copy Code
exampleJob.Parameters.Add(nameParamater);

In order to save the Job you must call the update method. After doing this the Job should be visible in the JAMS Client in the folder ("ParentFolderName") you specified, or the root folder if you did not specify a location.

Saving Changes
Copy Code
exampleJob.Update(jamSver);
See Also

 

 


Copyright © Fortra, LLC and its group of companies.
All trademarks and registered trademarks are the property of their respective owners.