Jump to content
Changes to the Jaspersoft community edition download ×

passing parameters from java file


2004 IR Help

Recommended Posts

By: sherfoong - sherfoong

passing parameters from java file

2004-07-18 20:22

does anyone here knows how to pass parameters from a java file, and use it in the report?

 

 

 

 

By: C-Box - c-box

RE: passing parameters from java file

2004-07-18 23:59

try to put all your needed parameters into the parametermap when filling the (master)report.

 

HashMap paraMap = new HashMap();

paraMap.put("ParameterName1",parameterValue1);

paraMap.put("ParameterName2",parameterValue2);

JasperPrint jrPrint = new JasperPrint();

jrPrint = JRFillManager.fillReport(yourMasterRepAsObject,paraMap,yourGetConnectionMethod());

 

Within your report you define all the parameter in the parametersection and so you can use all the parameter that are within that paraMap.

 

that's all! :-)

 

hth

C-Box

 

 

 

 

 

By: superzech - superzech

RE: passing parameters from java file

2004-07-28 20:24

the HashMap class is NOT found when i put in Java code.

May i know what jar file do i have to import?

 

thanks.

 

 

 

 

By: Ganesh Bansal - ganeshbansal

RE: passing parameters from java file

2004-07-28 21:44

HashMap class is inside java.util package.

 

u can use it as:

 

import java.util.HashMap;

 

Ganesh

 

 

 

 

By: superzech - superzech

RE: passing parameters from java file

2004-07-28 22:26

thanks alot Ganesh!!

 

Good day to you.

 

zechen.

 

 

 

 

By: superzech - superzech

RE: passing parameters from java file

2004-07-29 02:25

Good day C-Box,

 

JRFillManager.fillReport(yourMasterRepAsObject,paraMap,yourGetConnectionMethod());

 

when i try using the JRFillManager in JBuilder, an error says :

 

Cannot resolve symbol:variable JRFillManager

 

 

 

 

By: superzech - superzech

RE: passing parameters from java file

2004-07-29 02:25

Good day C-Box,

 

JRFillManager.fillReport(yourMasterRepAsObject,paraMap,yourGetConnectionMethod());

 

when i try using the JRFillManager in JBuilder, an error says :

 

Cannot resolve symbol:variable JRFillManager

 

please help.

thanks.

 

 

 

 

By: C-Box - c-box

RE: passing parameters from java file

2004-07-29 02:46

Well it depends if you instantiate an fbject of the JasperFillManager .. (i did so in my sample code above - it was just a code snippet and not everything you need)

 

Because the Fillmanager is static you needn't build a own object of it... you can also use:

 

jasperPrint = JasperFillManager.fillReport(yourMasterRepAsObject,paraMap,yourGetConnectionMethod());

 

that should work... it was my error... sorry

 

hth

C-Box

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...