Jump to content
Changes to the Jaspersoft community edition download ×

Input Controls on Jaspersoft AWS

Go to solution Solved by mmflynn,

Recommended Posts

Running Jaspersoft Business Intelligence Server on AWS:
I am seeing several curious things regarding Input Controls. I wanted to add a parameter to a report, so I created an Input Control - a dropdown list that supports multiple selection. 
When I run the report though, the Input Control appears, but all of the entries are blank. They're there, and you can select them, but they appear as blank lines. 
No problem, I thought -- maybe I did something wrong. So I went to the report in the repository, selected it and then clicked on the "Edit" button up on the menu bar at the top of the list of reports. 
I get the "Set Up the Report" page, with a little menu box on the left with the selections: "Set Up", "Controls & Resources", and so on. I select "Controls & Resources" and on the resulting page are all 
of the Input Controls for the report. Each control is a clickable link (I see in the browser status bar that clicking on a control will invoke: javascript:resourceReport.editControl('controlName')
Great, so I click on the link for the control and then - the next page is "Locate Input Control". The choices are 1) Define an Input Control in the next step, or 2) Select an Input Control from the repository
Well, I don't think that I want to "define" one, I did that already. So I select Select from the repository but then I cannot find the control anywhere in the repository. So I am stuck. 
Try this for the Freight Report (/organizations/organization_1/reports/samples/Freight). Try and locate the "Country" input control. I don't know if this is maybe a permissions/roles issue, but I tried it with
jasperadmin, superuser, our users with our roles, etc etc
Should we be able to edit Input Controls? Thanks for any insight.

This may be related to: http://community.jaspersoft.com/questions/811820/input-controls-jasperserver-pro-aws-ad-hoc-viewsreports

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

That is capable of misunderstood, what you want indeed is to "define" an input control. Select that and the next buttons will bring you to editing your control.

BTW, I would recommend to define input controls once in the repository of JS, then only link them to your reports (especially you are using the same input control for multiple reports, that will ake maintainability much more easy).

As I can see in my test server, you will have to select the "visible column" explicitely at the end of the controls configuration dialogs. Otherwise the presentation of the control won´t show anything.

Cheers, Thomas


Link to comment
Share on other sites

  • Solution

Hi John - Based on your reference to the Freight report, I assumed you're using iReport and not the Ad Hoc report designer. If you're using Ad Hoc, then I need a bit more info on exactly what you're doing. Otherwise, continue on.

Mastering the input control is very liberating. What you ran into is the flip side of a feature that is flexible and powerful. Unfortunately it was not obvious.

I'll use your suggestion of the Freight report as an example. When you edit the Freight report unit and click the Controls and Resources tab, you see three input controls: Country, RequestDate and OrderId. These input controls were created to be part of the report unit. You can think of them as tightly bound. I recommend that you NOT set them up this way, but as reusable controls, but you'll learn that when you get to the reference material at the end..

To see how this input control is defined, click on it. The Locate Input Control opens, and as you note, there are two choices. The first is what you want, and it really should read "Define or Edit an Input Control in the next step." Click Next.

On the Create Input Control page, you can type anything you want for the prompt. It could be as simple as "Country" or more elaborate, such as "Select a country from the list", etc. The really really important part to making the input control work with your report is to exactly match the Parameter Name. This value needs to be the same spelling and case as the parameter in your report. References on how to do this at the end of this post.

Back to the example. The Type selected for this input control is "Single-select Query". Click Next. The Locate Query page appears. Again, the first option should read "Define or Edit a Query in the next step." With that selected, click Next. 

The next three steps walk you through naming the query as a resource, selecting its data source (what are you going to query) and then the query itself. 

After you click Save, you'll see the Set Parameter Values page. It's not important for our example, and it can be confusing or seem redundant. For our example, just click Submit. Now, I'll tell you the reason for this page. Assume for a moment that your database includes two columns - one for the Country name (e.g., type = varchar) and another for the Country code (e.g., type = smallint). For the sake of efficiency, maybe you want to use the Country code (e.g., smallint) in the database WHERE clause instead of the varchar. But to minimize human error, you want to present the list of country names (e.g., varchar) to the user. This page allows you to do that with the "value" and "visible" columns. In this hypothetical example, the visible column could be country name and the value could be country code. To make this work, the SQL statement on the previous page needs to include both columns, e.g., something like this: 

select country, countryCode from ORDERS group by countryCode order by country

I added the order by so the country names would be in alphabetical order for the humans. If your data is pre-sorted in the database it may not be necessary.

Hopefully this gives you enough to accomplish your near-term goal. Here's more information to help you out:

Online help: http://help.jaspersoft.com/js-help-v5-en//Default.htm#search-input control

JasperReports Server Administration Guide, sections 4.3 and 4.4: http://community.jaspersoft.com/documentation/jasperreports-server-administration-guide

iReport Ultimate Guide, section 6.2.1 Using Parameters in a Query: http://community.jaspersoft.com/documentation/ireport-ultimate-guide

I hope this helps.

Mary Flynn


Link to comment
Share on other sites

Thank you  very much for your assistance! 
I am indeed using iReport, editing the report and then using "Replace with current document" in the Repository Navigator. 
It's helpful to realize that the "Define an Input Control in the next step" can really be interpreted as "Thank you  very much for your assistance! It's helpful to realize that the "Define or Edit an Input Control in the next step." Once that's selected, it's really just a series of "Next" button clicks to go through the steps of editing the input control. 
I was able to fix the query that the control uses. Now all I need to do is get the parameter for the report working so that I actually get results! 
Thanks again.



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