0
    public void showApplicantCountVsJobBoardsSimpleReport(Collection<ApplicantCountVsJobBoardsDTO> applicantCountVsJobBoardsList,HttpServletRequest request) throws ColumnBuilderException,ClassNotFoundException, JRException {        
            initStyles();  
            FastReportBuilder drb = new FastReportBuilder();
            setTitleProperties(drb,"Job Board by Company and Job Title");   
            reportTitle = "Job-Board-by-Company-and-Job-Title";       
            DynamicReport dr = createApplicantCountVsJobBoardsSimpleReport(drb, applicantCountVsJobBoardsList); 
            jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), new JRBeanCollectionDataSource(applicantCountVsJobBoardsList));
            request.getSession().setAttribute("JasperPrintObject", jp);
            request.getSession().setAttribute("ReportName", reportTitle);
            displayReport(request, 0);     
        }   

        private DynamicReport createApplicantCountVsJobBoardsSimpleReport(FastReportBuilder drb, Collection<ApplicantCountVsJobBoardsDTO> applicantCountVsJobBoardsList) {
            AbstractColumn columnCompanyName = setStringColumnProperties("companyName","Company Name",100);
            drb.addColumn(columnCompanyName);

            AbstractColumn columnJobTitle = setStringColumnProperties("jobName","Job Title",200);       
            drb.addColumn(columnJobTitle);      

            AbstractColumn columnTotal = setStringColumnProperties("totalApplicantForJob","Total",100);
            drb.addColumn(columnTotal);     

            return drb.build();
        }


public class ApplicantCountVsJobBoardsDTO {

    private String companyName;
    private String jobName;
    private Integer totalApplicantForJob;
    private HashMap<String, Integer> jobBoard;

    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }   
    public Integer getTotalApplicantForJob() {
        return totalApplicantForJob;
    }
    public void setTotalApplicantForJob(Integer totalApplicantForJob) {
        this.totalApplicantForJob = totalApplicantForJob;
    }
    public HashMap<String, Integer> getJobBoard() {
        return jobBoard;
    }
    public void setJobBoard(HashMap<String, Integer> jobBoard) {
        this.jobBoard = jobBoard;
    }
}

I don't have any idea to add the jobBoard items to the report.. Each item in the jobBoard object will be a column in my report. Please help me. I am new to Jasper. :(

I am using net.sf.jasperreports and ar.com.fdvs.dj jars

Alex K
  • 22,315
  • 19
  • 108
  • 236
skmaran.nr.iras
  • 8,152
  • 28
  • 81
  • 116

1 Answers1

0

In this Case you will have to use subreport feature of ireport tool in which you pass hashmap as a datasource and ther in that report you decide layout and design of your report.

  • could you please give me the code flow also. I also saw sub report creations. Tried. but not working. :( – skmaran.nr.iras Mar 26 '13 at 06:20
  • you have to add jobBoard field and set its datatype as HashMap. Then you pass this in subreport as a datasource. Hope you are using iReport tool to set the layout of your report. I can help you futher but I am not getting you code.If you could give me your email ID I will forward you a sample code which uses subreport – swapnil_nerd May 12 '13 at 07:33