DataSource
element.
You use the Roles
element to identify how
a variable from the input data source is used in the task.
Metadata
element:
<Metadata> <DataSources> </DataSources> <Options> </Options> </Metadata>
DataSources
element:
<DataSources>
<DataSource name="inlibname">
</DataSource>
</DataSources>
DataSource
element,
you are specifying a name for the input data source. You refer to
this name later in the task definition. In this example, the name
of the data source is inlibname
.
Roles
element, which is a child
of the DataSource
element.
DataSource
element:
<DataSources>
<DataSource name="inlibname">
<Roles>
<Role name="invarname" type="C" minVars="1" maxVars="1">
Character variable to convert</Role>
</Roles>
</DataSource>
</DataSources>
1 | The name attribute
specifies the name for the role. In this example, the name of the
role is invarname .
|
2 | The type attribute
specifies the type of variable that can be assigned to this role.
In this example, only character variables (represented by type=”C” )
can be assigned to this role. In the user interface for the task,
character columns are identified by the ![]() |
3 | The minVars attribute
specifies the minimum number of variables that must be assigned to
this role. In this example, a character variable must be assigned
to the Character variable to convert role
in order for the task to run, so minVars=”1” .
In the user interface for the task, a red asterisk appears next to
the name of this field to indicate that a variable is required. If
no variable is assigned to this role, the task cannot run.
|
4 | The maxVars attribute
specifies the maximum number of variables that can be assigned to
this role. In this example, only one variable can be assigned to this
role.
|
5 | Character
variable to convert is the label for this field in the
user interface.
|
Option
elements.
Options
element.
</DataSources>
...
<Options>
<Option name="dataTab" inputType="string">DATA</Option>
<Option name="dataGroup" inputType="string">DATA</Option>
<Option name="rolesGroup" inputType="string">ROLES</Option>
</Options>
</Metadata>
Option
elements,
you specified the following information:
dataTab
.
You use this name again in the UI
element.
UI
element.
UI
element
follows the closing Metadata
element. In
the UI
element, add the following code:
<UI>
<Container option="dataTab">
<Group option="dataGroup" open="true">
<DataItem data="inlibname" />
</Group>
<Group option="rolesGroup" open="true">
<RoleItem role="invarname" />
</Group>
</Container>
</UI>
1 | Container elements
enable you to add tabs to your user interface. To create multiple
tabs, you need multiple Container elements.
In this code example,
you are creating only the DATA tab. You specified
the name (
dataTab ) and UI label (DATA)
for this tab in the metadata. <Option name="dataTab" inputType="string">DATA</Option> Because only one container
is defined for this task, all the remaining UI elements appear on
the DATA tab.
|
2 | In
the first Group element, option=”dataGroup” refers
to the dataGroup name that you defined in
the metadata.<Option name="dataGroup" inputType="string">DATA</Option>In the user interface, the label for this group is DATA. The
DataItem element
creates the field for the input data source. In this example, the
name of the input data source is inlibname ,
which was defined in the DataSource element
in the metadata.
|
3 | In
the second Group element, option=”rolesGroup” refers
to the rolesGroup name that you defined in
this code in the metadata.<Option name="rolesGroup" inputType="string">ROLES</Option>In the user interface, the label for this group is ROLES. The
RoleItem element
creates a field for selecting the character variable that you want
to convert. You defined this role in the Roles element
in the metadata. <DataSource name="inlibname"> <Roles> <Role name="invarname" type="C" minVars="1" maxVars="1"> Character variable to convert</Role> </Roles> </DataSource> The name of this role
is
invarname . When displayed in the user
interface, the role is labeled Character variable to convert.
|
UI
element
to specify how these items appeared in the user interface. You defined
the contents of the UI
element in Add the Input Data Source and Roles Fields to the User Interface.