You have two options for defining the parameters of a data source. You can either:
| • | Specifically define the parameters, like host, port, and database. |
| • | Have the server derive these parameters at runtime based on attributes you provide. |
Attributes can be used to derive all data source parameters that are not selected from drop down lists.
When defining a data source attribute, you can either specify the category in which the server should look for its value, or allow the server to locate the value hierarchically.
Resolving Attributes by Category
If you specify a category for the attribute value, for example user, the server will use the value specified in the logged in user's attributes for the data source parameter. If the attribute is not defined where specified, the report fails with an error. You can specify these attribute categories:
Resolving Attributes by Hierarchy
If you don't specify a category for the attribute, the server searches attributes hierarchically and uses the value of the first profile attribute it finds. This search starts with the logged in user, then proceeds to the user's organization and, finally, the server level. If the specified attribute is not found, the report fails with an error.
The following figure is an example of attributes used to define data source parameters.
|
Using Attributes for Data Source Parameters |
In the example above, the following data source parameters are specified by attributes:
| • | {attribute('host','User')} - Host will be derived categorically from the logged-in user's attributes, because the "User" category is specified. |
| • | {attribute('port','Tenant')} - Port will be derived from the logged in user's organization attributes. |
| • | {attribute('port','Server')} - Database will be derived from the server-level attributes. |
| • | The URL defaults from the host, port, and database fields automatically. |
| • | {attribute('userName')} - The user name will be derived hierarchically, because no category is specified. JasperReports Server will look for a host first in the logged in user's attributes, then in the organization attributes, and finally the server-level attributes. |
| • | {attribute('password')} - The password field can also reference an attribute, here a hierarchical attribute. |
For information about user attributes, see Editing User Attributes
For information about defining organization and server attributes, see Creating Attributes on Organizations
Recommended Comments
There are no comments to display.