Example 1: Accessing a record for a UDO and registering the UDO with the report system

This example describes how to access a record for your UDO and how to register your UDO with the report system.

  1. A UDO needs to implement at least four classes from JReport. The four classes are for template, result, creator and render files respectively.
  2. Compile the Java files.

    To compile these four Java files, you should add report.jar and JREngine.jar with their path into the class path. For example, use the following command:

    Javac -classpath "C:\JReport\Designer\lib\JRengine.jar;C:\JReport\Designer\lib\report.jar;C:\test "MyDbFld.java

    Here it is assumed that JReport Designer is installed to C:\JReport\Designer. The Java files for the example are in C:\test\myudo.

  3. Modify the udo.ini file in the <install_root>\lib directory by appending the four classes as follows:
    Begin
    name=MyDbField
    template=myudo.MyDbFld
    resultobject=myudo.MyDbFldRst
    resultcreator=myudo.MyDbFldCreator
    resultviewer=myudo.MyDbFldRender 
    End
    
  4. Edit JReport.bat in <install_root>\bin, append the four classes to the class path. Assume that the four classes are located in d:\test\myudo.

    Change: ... -classpath "c:\jreport\designer\lib\report.jar; ...c:\temp"...
    To : ... -classpath "c:\jreport\designer\lib\report.jar;d:\test; ... c:\temp" ...

  5. Start JReport Designer with the modified batch file.
  6. Click Insert > UDO. You will now find a new UDO object named MyDbFld in the drop-down list of the Insert UDO dialog.