Before running the demo, you need to do the following:
<install_root>\help\samples\APIUDS\javaUDS
to <install_root>\help\UDSForJavaBean
. You need to create the UDSForJavaBean directory.javac -classpath <install_root>\help\UDSForJavaBean;<install_root>\lib\JREngine.jar;<install_root>\lib\log4j-1.2.8.jar; <install_root>\help\UDSForJavaBean\jreport\uds\javabean\*.java
<install_root>\help\UDSForJavaBean
to <install_root>\bin
.<install_root>\help\UDSForJavaBean
in the ADDCLASSPATH variable in setenv.bat in the <install_root>\bin
directory.Sometimes, the attributes of a Java object are defined by other lists/collections, such as the Java object SimpleBeanTest in <install_root>\help\UDSForJavaBean\jreport\uds\javabean\beans
. It is defined as follows:
|
From the code above, you can see that the Java class SimpleTestBean contains an array of Persons, a collection of addresses and an array of Int values.
For this kind of Java object, JReport Designer can create a report that gets records from the SimpleTestBean, but it cannot show the list of persons information in the same report. If you want to create such a report - each record comes from the SimpleBeanTest object, and for each record, display the list of persons information - you have to use the primary report and subreport to implement this function. For how to do it, see the demo below.
Name: pNumOfFakeData
Value Type: Integer
Prompt Value: Any integer number. Note that the parameter must have at least one value that is larger than 0, otherwise you will get exceptions when viewing reports.
For details about how to create parameters, see Creating a parameter.
<install_root>\help\UDSForJavaBean\jreport\uds\javabean
, and then choose UDSForJavaBean.class. The UDS class UDSForJavaBean.class will import the class jreport.uds.javabean.beans.SimpleTestBean with full class name.JavaBeanDS_DataProvider=jreport.uds.javabean.GenericBeanDataProvider
&JavaBeanDS_RuntimeDataID=&GBeanProvider_BeanClsName=jreport.uds.javabean.beans.SimpleBeanTest
&GBeanProvider_UseFakeData=true&GBeanProvider_NumOfFakeData=@pNumOfFakeData
&GBeanProvider_FakeDateSubCollectionInfo=persons,jreport.uds.javabean.beans.Person
&GBeanProvider_RptDataInitializer=&GBeanProvider_ListOfDetailProps=persons,1,30000
All the highlighted names in the parameter string above are the key words for the information required by this UDS and related Java class. See the detailed explanation below:
In this demo, only the sub-collection property persons will be imported from the SimpleTestBean class, and the share time is 1. If you want to create another subreport using addresses, you have to specify the value for this key word as the following:
=&GBeanProvider_ListOfDetailProps=persons,1,30000$addresses,1,30000
and different properties are separated by the symbol $.
<property name>,<property class name>$<property name>,<property class name>
, the fake data for those sub-collections will not be constructed, and problems will occur when running the report on fake data. Name: pUseFakeData
Value Type: Boolean
Prompt Value: True
Name: pRunTimeDataInfo
Value Type: String
Prompt Value: persons
<install_root>\help\UDSForJavaBean\jreport\uds\javabean
, and then choose UDSForJavaBean.class.JavaBeanDS_DataProvider=jreport.uds.javabean.GenericBeanDataProvider&JavaBeanDS_RuntimeDataID=@pRunTimeDataInfo&GBeanProvider_BeanClsName=jreport.uds.javabean.beans.Person&GBeanProvider_UseFakeData=@pUseFakeData&GBeanProvider_NumOfFakeData=@pNumOfFakeData&GBeanProvider_RptDataInitializer=jreport.uds.javabean.SubRptCollectionDataInitializer
All the highlighted names in the parameter string above are the key words for the information required by this UDS and related Java class. See the detailed explanation below:
return false
. This formula will be passed into the subreport as the value of the parameter pUseFakeData in the subreport, so that when the subreport runs with the primary report, it will always use the data from the primary report instead of constructing the fake data itself.Parameter | Value |
---|---|
pNumOfFakeData | pNumOfFakeData |
pUseFakeData | NotUseFakeData (gives a false value to the parameter) |
pRunTimeDataInfo | persons (specifies to use the sub-collection persons of the primary report as the data source of the subreport at runtime) |
For more information about subreport in JReport, see the section Subreports.