This example is a plain text file AddressesList.txt (available in <install_root>\help\samples\APIUDS\txtUDS
), 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.
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\samples\APIUDS\txtUDS
.
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 to <install_root>\help
, and add the additional entry to the ADDCLASSPATH variable of the batch file setenv.bat in <install_root>\bin
.
For example, on Windows, if you installed JReport Designer into the default directory C:\JReport\Designer
,
C:\JReport\Designer\help
.javac -classpath "C:\JReport\Designer\lib\JREngine.jar" Address*.java
C:\JReport\Designer\bin
.
set ADDCLASSPATH=%JAVAHOME%\lib\tools.jar;C:\JReport\Designer\help;
After compilation, you can now add the UDS to a JReport catalog.
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 page report.