开发者

Defining Fields in jasper report

The data which has to display is coming from three tables and i am defining the fields in jasper report/ir开发者_运维百科eport. But there is no data to display. i am also passing a correct a datasource. I want to know is there an issue in defined fields in ireport or how to define a fields for specific table in ireport. foe e.g if there is a field abc in table1 then there is also a field abc in table 2. Is it to define a field by giving a specific table or just give a field name in ireport.


For example we have two tables:

ADDRESS (ID Integer, FIRSTNAME String(256))

and

DOCUMENT (ID Integer, ADDRESSID Integer)

The query in report template should be like this:

<queryString>
    <![CDATA[SELECT
 ADDRESS.ID AS ADDRESS_ID,
 ADDRESS.FIRSTNAME AS ADDRESS_FIRSTNAME,
 DOCUMENT.ID AS DOCUMENT_ID,
 DOCUMENT.ADDRESSID AS DOCUMENT_ADDRESSID,
 FROM ADDRESS, DOCUMENT WHERE ADDRESS.ID=DOCUMENT.ADDRESSID]]>
</queryString>
<field name="ADDRESS_ID" class="java.lang.Integer"/>
<field name="ADDRESS_FIRSTNAME" class="java.lang.String"/>
<field name="DOCUMENT_ID" class="java.lang.Integer"/>
<field name="DOCUMENT_ADDRESSID" class="java.lang.Integer"/>

The aliases using (ADDRESS_ID and DOCUMENT_ID in this sample) helps to avoid collision with existence of several columns with the same name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜