All Parameter Types
Q100031: All Parameter Types
Modules can use a number of different parameter types. Each type allows for a specific kind of data to be input to, or output from, the modules at runtime. The different types will automatically provide an appropriate user interface for entering values in the Desktop Application Manager
for JobServer.NET. In this article, we are are going to detail the various supported types, as well as detailing various options that each type supports. If you are only using the included or pre-built downloadable modules for JobServer.NET, you will not visibly see a lot of these details beyond how it may affect the user interface in the manager application. However if you are going to be building custom modules, you will likely want to be familiar with this information.
Basic Data Types
The basic data types supported are going to be familiar to C# developers as these are directly based around most of those base types. The table below outline the basics of these base types.
Type | Description |
---|---|
Bool | The bool, or boolean value is for being able to specify a value that is boolean. Or in other words, has two states, such as Yes/No, On/Off, etc. When this is used, the user interface in the manager application uses a checkbox control which only allows the user to toggle the value between the valid states. |
Number | The number type is for being able to specify some type of numeric value. When this is used, the user interface in the manager application only allows a valid numeric value to be specified. Within the module, this may be any of the standard C# numeric types such as int, or decimal. |
Date | The date type is for being able to specify a date value. The manager application enforces the entry of a valid date value. |
String | The string type is a sequence of individual Unicode characters. When this is used, the user interface in the manager application provides an appropriate textbox to edit the value. |
Choice (Enum) | The choice (enum) type allows for the selection of a single item from a list of multiple values. Or it provides the option to select any number of options from a limited pre-defined set of values. |
ListString | The liststring type allows for the input to be a list of string based values. This is commonly used when a module expects to work with one or more files at a time, such that a list of the file can be provided to the module as a single parameter value. |
Implementing Beyond the Basic Data Types
The basic types outlined in the previous section should be fairly obvious for many usage cases. In moving beyond just the basic types, there are certain types that can be used in a more advanced fashion as module parameters. The table below introduces these options for the module developer.
Type | Description |
---|---|
List |
A list of string values which can be provided to input parameters. |
Enum | A standard enum, or enumeration type allows for creating a pre-defined selection of valid values that can be chosen. When this is used, the user interface in the manager application provides a drop-down list of the valid values to select from. The list presented is based from the enum names. |
Enum with flag attribute | An enum that uses a flag attribute in its construct, can be used when a single parameter can be specified with multiple and any combination of compatable boolean states. When this is used, the user interface in the manager application provides a multi-select drop-down which allows the end user to select any combination of the individual flag values. |
Attributes for Parameters
When defining the parameters for use with a module, there are a number of additional attributes which can also be included with each parameter. These help provide more advanced support for user interface options, as well as providing sane default values and other such helpful features for both the end users and developers. End users will see this as how the attributes affect the options on the user interface for the individual parameter fields. Custom module developers will see these as the ParamDef
flag and attributes that is used with the parameter definitions. There are multiple properties for the ParamDefs as can be seen in the list below.
Property | Description |
---|---|
Caption | The caption displayed on the parameter editor. This should be a short value, used as a field prompt. |
Description | A longer description of the parameter. Displayed in the field editor when the user selects the field. Should be a longer, more decriptive value of what the field does or provides. |
ModuleParameterType | Internally within the module, this is the basic data type that JobServer modules can implement. Refer to the first section of this article for the complete list. |
ModuleParameterDirection | The direction of the parameter within the module. This should be set to one of three possible values: In , Out , InOut . The In parameter is expecting to be provided a value as input to the module. The Out parameter is expecting to output a value once the module completes executing. The InOut parameter combines both features. In such cases, modules may modify the value that is output making it different from the original value supplied to the module as input. |
IsRequired | A boolean value that denotes if the parameter is a required field or not. For base types that are nullable , then leaving or setting this to False will result in the parameter being NULL at execution time. If set to True for a parameter with a nullable type and a default attribute is specified, then the parameter will use the default when no user specified value is provided. |
AllowMultipleSelections | This is true when the enum for the property is implemented using flags, which will allow multiple choices to be selected in the user interface. When false , then only a single choice can be selected from the list. |
DecimalPlaces | Allows specifying the number of decimal places that the parameter should support. Limited by the chosen underlying data type. Example, setting this has no effect for an INT data type, whereas you can specify it for the DECIMAL type parameters. |
MinValue | For numeric parameters, this allows the definition of what the lowest valid or allowable value is for the parameter. |
MaxValue | For numeric parameters, this allows the definition of what the highesst valid or allowable value is for the parameter. |
Default | The default value for the parameter if the end user does not specify a value. Regardless of the base type, the default value should always be specified as the stringified equivelent. |
IsPassword | For string type parameters, setting this to true will allow the user interface in the management application to obscure the value being entered for enhanced security. |
ConnectType | For modules that typically need a method to communicate with outside services external to the JobServer, there are multiple predefined connection types . The connection types allow for a centralized and managed method for keeping the connection definition. |
Example Implementation of a Custom Module Using All Parameter Types
The link below provides a downloadable source code copy of a custom module project for Visual Studio which shows all the parameter types. Along with the parameter types, a variety of the combinations of various supported attributes are shown. The source code for the project allows quick and easy experimentation with the variety of supported parameter types.
Download JobServer.NET Parameter Types Example project for Visual Studio
Once you download and build the example module, you can install it in your JobServer.NET installation and see how the parameter types and attributes are manifested in the Manager
application when you use the module. When installed, it should appear as shown below.