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

SQL Query Help


Developer_jasper

Recommended Posts

Hi;

Can someone guide me in right direction. All i want is that before report being accessed on jasper server by the user, it should ask the user to enter value (something like prompt window) so if user enter value, it should display data according to the value given by the user.

for instance. user want to access emp_id, emp_name and emp_joining_date from emp table. what i really want is the prompt window which comes up when report is being run and ask for the emp_joining_date and then show details of all employes joined on that data and afterward. I need sql query based on this scenario for iReport.

All i can think is that sql query but dont know how to put in iReport.

SELECT emp_id, emp_name, emp_joining_date

FROM emp

WHERE emp_joining_date <= (value entered by user)

 

value must be entered through prompt window.

Any help thanks in advance.

Kind regards.

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

If you want Jasperserver help you would get more responses in the Jasperserver forum.

That being said you want to add a parameter to your report. Once added this param needs to be inserted into the query

select * from table where column1 = $P{userInput}

In Jasperserver there is a component called input controls.

First you need to deploy your report to Jasperserver and set up a datasource there. Next you can create an input control called 'userInput' and link it to the report. What this gives you is a form (jsp or ajax based) that is shown at the start of the report execution in the server. This form will collect and validate a user input and pass it into the report to be used in the query.

I recommend you get a copy of the iReport definitive guide and read up on parameters (specifically as used in queries). Also when you install Jasperserver it comes with a user guide. Read up on input control in this.

I hope this helps.

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