You can add a custom attribute to a schema and use it as
a variable. By doing this, you can create a sort on the custom attribute,
which you cannot do on regular attributes. You can also design a template
that uses a particular attribute as a variable, but then you can change
the attribute easily at run time.
Before you begin
Create a variable.
About this task
- You can only add custom attributes in the entry points of the
data source schema. These entry points are the only places in the
data source schema where Rational® Publishing Engine can
save the changes. You might not be able to tell from the data source
schema where these entry points are, but if you are unable to add
a custom attribute, you know that the location is not an entry point.
- Custom attributes cannot be used in native filters.
- You cannot edit with the Schema discovery wizard, export, or replace
data source schemas that contain custom attributes.
Procedure
- In the Data Source Schemas view, right-click a query. If the query permits custom attributes, the New
Special Attribute option is available.
- Click New Special Attribute. The New Special Attribute window
opens.
- Enter a name for the attribute. This name
is visible from the Data Source Schemas view. The name must use valid Java™ or JavaScript identifiers since they are
used in scripts.
- Enter a description for the attribute.
- For the Value, select Attribute or Variable.
- Select a query to add as a child.
- Select the Use Condition option
to enable sorting and filtering on the child properties of the attribute.
The condition operator is always that the attribute equals the variable.
- In the Attribute field, select an option.
- In the Variable field, select the variable that you
created to use with the custom attribute.
- Click OK.
Note: When you copy queries that have custom attributes
with variables in them, verify the pasted results. Custom attributes
and the variables they use might not be copied over correctly, so
you must fix the custom attributes and add the variables again, if
necessary.
What to do next
When you publish the document, select an attribute to enter
as the variable.