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

pass variable values as parameter values in sql query -HOW?


raparlasiva

Recommended Posts

 Hi,

 

I have created four parameters in my ireport

1. calendar

2.  week  --->Prompt

3. year  ---> Prompt

4. formatter

I have calculated the date range using the 4 above parameters ('startDate' , 'endDate')

 

My report lets  the users see the number of orders from  week number and year they choose from the dropdown box.

. My issue is  now how to  pass the variable values of 'startDate'  and'endDate'  to the sql query i.e, the stored procedure

(call stored_procedure('startDate' , 'endDate')

 

 



Post Edited by raparlasiva at 09/10/2012 19:40
Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

 I'm assuming you calculated your dates in new report parameters, and those parameters are named  'startDate' , 'endDate'.

So for using them in your query you need to use the $P{param_name} syntax. In your case:

call stored_procedure($P{startDate} , $P{endDate})

See: http://jasperforge.org/website/ireportwebsite/IR%20Website/ir_using_parameters.html?header=project&target=ireport

 

Mariano

Link to comment
Share on other sites

Sorry I did not read your post correctly. You are saying that you've calculated those dates in Variables, Variables scope starts after the query has been executed and may have evaluation times.

 

In your case you will need to do the calculation of your dates in Parameters using the parameter default expression property. Also check the ORDER of the parameter sin the Report Inspector because iReport will execute them in that order. So your StartDate and EndDate parameters should be the last ones.

Link to comment
Share on other sites

 i have two parameters

1. week and

2. year

both use as prompt on ireport.

But when I add a single value input control and run the same report on jasper server, the single value input control is  not visible and only a pop up window is opening up.

I want to know why my single value input control not showing up when I am running the report on jasper server ?

 

thanks

Siva

 

 

Link to comment
Share on other sites

  • 2 years later...

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