### Adding a UDS to a catalog

To add user defined data sources to a catalog, follow the steps below:

1. Open the catalog to which you want to add the UDS.
2. In the Data tab of the Catalog Browser, right-click the catalog data source to which the UDS is to be added, then select Add User Defined Data Source from the shortcut menu. The Add User Defined Data Source dialog appears. See the dialog.

3. In the Name field, specify a name for the UDS as required.
4. Provide the class name with package name in the Class Name field. You can also click Browse to find the class file. The class you entered should actually exist and can be found by JReport Designer, which means the class should be in the class path of the system environment. After filling in this field, the class name of the interface that the class implements will be displayed automatically behind The class implements:.
5. Specify the parameter for the UDS in the Parameter box. The parameter string must match the format defined in the UDS class. You can use parameters or constant level formulas predefined in the current catalog data source or the special field User Name in the parameter string, and the format of the predefined parameters used in the string is "@" + parameter name. For example, if the parameter string of a UDS is SQL=select * from employee, and you want to use the parameter sql in a catalog to replace the part after "=" in the string, then the parameter string of the UDS will be SQL=@sql. If the special field User Name is used, to specify the user name, go to File > Options on the menu bar, in the General category of the Options dialog, set the User Name option.
6. Check the Specify Columns option to enable the column definitions list and add column definitions. If you don't specify the column definitions, JReport will get them from the result set automatically.
   - Name
     The name of a column. It should have the same validation with a common table column. The default names for column definitions are ‘column1', ‘column2', and so on.
   - SQLType
     The data type of the column.
   - Precision, Length, Scale, Radix
     The default value for each SQL type. Click the cell and modify the value if necessary.
   - Nullable
     Indicates whether the value of the column can be null. X stands for NoNulls, √ stands for Nullable and ? stands for Nullable Unknown.
7. Click OK to add the UDS.

See also the examples in Developing reports from UDS for details about how to add some specific UDS to a catalog.

Note: JReport Designer supports the Dynamic UDS feature. This feature improves performance significantly by retrieving the selected fields. At runtime, an option is provided for you to pick up the columns you want to see in the report. Also, JReport Designer will generate dynamic report according to user's selection. For details, see Example 4: Developing reports with dynamic UDS.