Jump to content
We've recently updated our Privacy Statement, available here ×

Jasper report for the data which is not in databas


rsathish_gandhi

Recommended Posts

Hi,

I'm not having some values in database....That values are calculated in java method itself...

If I want to show that value in report means, Shall I Pass this as parameter?

If So, How can I pass the dynamic parameters? else,

               I stored that values in ArrayList... The size of the arraylist is not constant...How can I pass? How can assign parameter name?

See that code


Code:
public void orgInquireListReport(String contentType, String filename)throws  JRException, SQLException{        System.out.println("ContentType:"+contentType);        System.out.println("filename:"+filename);        String file=getClientLogoName();               String logopath=path+file;           Map map = new HashMap();               JRDataSource simpleDS;        Util util = new Util();               JRBeanCollectionDataSource jrbds = new JRBeanCollectionDataSource(this.getShowPayClient());            List m1=new ArrayList();            m1.add(1);            m2.add(2);               try {            util.GenerateReport("D:/docs/OrgInquire.jrxml", m1, jrbds, contentType, filename);        } catch (IOException e) {            // TODO Auto-generated catch block            System.out.println("Error in IOException");            e.printStackTrace();        } catch (Exception e) {            // TODO Auto-generated catch block            System.out.println("Error in Exception");            e.printStackTrace();                   }    }    is it possible?Please help me?
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

yes, you can. JasperReports APIs provide a way to pass an arbitrary number of parameters to the report using an hashmap, all the parameters must be defined in the report with name and type.
This allows you to create a "parameter of parameters" creating a parameter called for instance myParametersArray of type ArrayList.

 

Giulio

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...