Working with the DataSources Element

About the DataSources Element

The DataSources and DataSource elements create a simple grouping of the data that is required for the task. If these elements are not specified, then no input data is needed to run the task.
The DataSource element is the only child of the DataSources element, and the DataSources element can have only one DataSource child. The DataSource element specifies the information about the data set for the task. The only child for the DataSource element is the Roles element.

Working with the Roles Element

About the Roles Element

The Roles element identifies the variables that must be assigned in order to run the task. This element is a way to group the individual role assignments that are needed for a task.
The Role tag, which is the only child of the Roles element, describes one type of role assignment for the task.
Attribute
Description
name
specifies the name assigned to this role.
type
specifies the type of column that can be assigned to this role.
Here are the valid values:
A
All column types are allowed. In the user interface, all columns are identified by the Generic Data Type icon icon.
N
Only numeric columns can be assigned to this role. In the user interface, numeric columns are identified by the Numeric Type icon icon.
C
Only character columns can be assigned to this role. In the user interface, character columns are identified by the Character Type icon icon.
minVars
specifies the minimum number of columns that must be assigned to this role. If minVars=”0”, the role is optional. If minVars=”1”, a column is required to run this task, and a red asterisk appears next to the label in the user interface.
maxVars
specifies the maximum number of columns that can be assigned to this role. If maxVars=”0”, users can assign an unlimited number of columns to this role.
exclude
specifies the list of roles that are mutually exclusive to this role. If a column is assigned to a role in this list, the column does not appear in the list of available columns for this role.
order
specifies that the user can order the columns that are assigned to this role. Valid values are true and false. If order=”true”, the user can use the up and down arrows in the user interface to modify the order.

Example: DataSources and Roles Elements from the Sample Task Definition

Here is an example of the DataSources and Roles elements:
<DataSources>
   <DataSource name="PRIMARYDATA">
      <Roles>
         <Role type="A" maxVars="0" order="true" minVars="1"
            name="VAR"> Required variable label</Role>
         <Role type="N" maxVars="0" order="true" minVars="0" 
            name="OPTNVAR" exclude="VAR">Numeric variable label</Role>
         <Role type="C" maxVars="3" order="true" 
            minVars="0" name="OPTCVAR">Character variable label<Role>
      </Roles>
   </DataSource>
</DataSources>
When you run this code, you get the Data and Roles sections in this example:
Data and Roles Sections in the User Interface
A red asterisk appears for the Required variable label role because you must assign a column to this role. In the code, this requirement is indicated by minVars=”1”.