zDroid
zDroid

Reputation: 426

Generate table report using sql joins in iReport

SELECT a.CIVIL_ID,a.PAT_NAME,a.SEX,a.PAT_NAT_CD,a.BIRTH_DT,a.ADDR,a.MOBILE_NO,b.FILE_NO,b.CREATED_DATE
    FROM PAT_MST a
    JOIN PATIENT_FILE b ON (a.PATIENT_ID = b.PATIENT_ID)
    AND( b.HOSP_DEPT_SEC_SERIAL = $P{P_HOSP_DEPT_SEC_CD})
    AND a.SEX = DECODE($P{P_GENDER},'ALL',a.SEX,$P{P_GENDER})
    AND TRUNC(B.CREATED_DATE)>=  TO_DATE($P{P_FILE_CR_DT_FROM},'DD/MM/RRRR') AND TRUNC(B.CREATED_DATE) <= TO_DATE($P{P_FILE_CR_DT_TO},'DD/MM/RRRR') 

I am using this query to generate a table report in iReport(5.6.0), but for some reason I am only getting the column headers but this query is returning records when I run on toad.

Please tell where I am wrong..

Upvotes: 1

Views: 135

Answers (1)

dreamca4er
dreamca4er

Reputation: 436

Are you using Table report element? If so, you are using not the main dataset but some other subdataset. You should transfer parameters values from the main dataset to the one of which your table "feeds".

  1. Add to your subdataset a parameter for an every parameter, used in main dataset.
  2. Right click on your table Edit table dtasource->select Parameters tab->click Add.
  3. In the Add/modify parameter window select your subdataset parameters in the upper menu. In the lower menu select their values (correspondent parameter from main dataset). Do this for an every parameter.

Upvotes: 1

Related Questions