Input Parameters

<< <%SKIN-STRTRANS-SYNTOC%> >>

Navigation:  Data > Using Data Input >

Input Parameters

Input parameters are named values that get their value assignments when an agent starts. You can specify these as command-line parameters when running an agent from the command line, or specify them in a GUI window when running the agent from the Windows desktop. Any data consumer command within the agent can use these parameters.

 

inputParameters

 

You can configure input parameters to get value assignments at runtime by using one of these methods:

A GUI window

Command-line parameters

The Content Grabber API

 

Input Parameters with a GUI Window

When running an agent from the Content Grabber editor and the agent has any input parameters, then the Runtime Input Parameters window will automatically appear.

 

Runtime Input Parameters

Runtime Input Parameters

 

The user running the agent can enter runtime values for the input parameters and can even add new parameters that are only defined during the current execution of the agent. An agent will always use the default input parameters when debugging. The Runtime Input Parameters window will not appear when starting a debugging session, so you will need to change the default values if you want to debug the agent with different input parameters.

 

Specifying Input Parameters on the Command Line

When running an agent from the command line, you can specify input parameters as command-line arguments. It's unnecessary to specify all of the input parameters. If you don't specify a parameter, the call to run the agent will use a default value for that parameter. See the topic Running Agent from the Command-Line for more information.

 

The following example runs an agent named Sequentum on the command line, and then sets the input parameters DepartureCity and DestinationCity.

 

RunAgent.exe Sequentum -DepartureCity "Sydney" -DestinationCity "Melbourne"

 

 

Specifying Input Parameters Using the Content Grabber API

When running an agent using the API, you can specify input parameters using the AgentSettings class in the Content Grabber API. See the topic Programming Interface for more information.

 

The following example uses the API to add a set of input parameters and then run the agent:

 

AgentApi api = new AgentApi(@"C:\Users\Public\Documents\Content Grabber\Agents\

qantasApiTest\qantasApiTest.scg");

AgentSettings settings = new AgentSettings();

settings.InputParameters.Add("from", "SYD");

settings.InputParameters.Add("to", "MEL");

settings.InputParameters.Add("departure_date", DateTime.Now.ToString("yyyy-MM-dd"));

settings.InputParameters.Add("return_date", DateTime.Now.ToString("yyyy-MM-dd"));

settings.InputParameters.Add("travel_class", "ECO");

settings.InputParameters.Add("adults", "1");

settings.InputParameters.Add("children", "0");

settings.LogLevel = AgentLogLevel.High;

settings.IsLogToFile = true;            

api.RunAgent(settings);

 

Using Input Parameters

Any data consumer command, such as the following, can use input parameters.

Agent

Navigate URL

Set Form Field

Data Value

 

Using Input Parameters

Using Input Parameters

 

 

Using Input Parameters in a Script

Most scripts provide easy access to input parameters from the script arguments. See the topic Scripting for more information. The following example retrieves the input parameter DepartureCity:

 

args.GlobalData.GetString("DepartureCity");