#### Example 1: Developing reports from flat file UDS

This example is a plain text file AddressesList.txt (available in `<install_root>\help\designer\samples`), which contains data information in a dummy table:

Laurena Croft 34826 Atwood St. New York City NY 10004 USA...
Jonathan Hopkins 5062 Brandon Green Ave. Minneapolis MN 55402 USA...
Jeremy Miner 9283 Cherry Leaf Lane Palo Alto CA 94303 USA...
....

You will notice that each line sequentially records the name, address, state, region, zip code, country, e-mail address and other information. In this example, you will be shown how to add an UDS using the data stored in a formatted text file. You can modify this example to meet your requirements.

##### Compiling and running the Address UDS

There are three classes used in this example and their source code are AddressListUDS.java, AddressListResultSet.java and AddressListResultSetMetaData.java. The data file is AddressesList.txt. All these files are available in `<install_root>\help\designer\samples`.

If you use your own UDS classes, you must be sure that the class files can be found when running. So, make sure that the directory is classpath/package name. For this demo's UDS classes, the classes belong to a package named help. Copy the above necessary files in `<install_root>\help`, and add the additional entry into the class path statement of the batch file that starts your JReport.

For example, on Windows, if you installed JReport into the default directory `C:\JReport\Designer,`

1. Copy the above necessary files to `C:\JReport\Designer\help`.
2. Compile the Java files.

   `javac -classpath "C:\JReport\Designer\lib\JREngine.jar" Address*.java`

3. Add the additional entry into the class path statement of the batch file that starts your JReport.

   `... -classpath C:\JReport\Designer;...`

##### Adding the Address UDS to a catalog

After compilation, you can now add the UDS to a JReport catalog.

1. Start JReport Designer with the batch file you just modified.
2. Open an existing catalog.
3. In the Data tab of the Catalog Browser, expand the data souce to which the UDS is to be added, then right-click the User Defined node and select Add User Defined Data Source from the shortcut menu.
4. In the Add User Data Source dialog, enter the following information:
   - Name: The name you want to use for identifying the UDS in JReport. Here we use Address.
   - Class Name: The class name of the UDS. You can type one in or click Browse to select a class file. Here we use help.AddressListUDS.
   - Parameters: AddressesList.txt
5. Click OK to add the UDS.

##### Developing a report with the Address UDS

Now that the Address UDS has been successfully added to the catalog, you can use it to develop reports as required. For details about how to create reports in JReport Designer, see Creating a report.