Loading values in ireport parameters box - jasper-reports

In ireport when clicking on preview, and you have parameters, you'll get a parameter box where you put a certain value to get specific record(s).Now i am trying to put specific values in the parameter box, so that the user would choose between it.
The same goal as in this so question : Loading promt box with parameters in iReport
However i want to do it without using Jasper Server. Is it possible to achieve this only from within IReport Designer?

You can do this,right click on the input control and select to add the local input control and provide id and name for the input control
Under the input control details select single select list of values if you have the list of values with you or if you want to add the data of a column as drill down select single select select query and extract that field.
This will help you to drill down the data.
Thanks and Regards
Megha

I'm pretty sure you can not do this in iReport preview. Have no clue what #Megha is refereeing to....
You can provide default value for your parameter through the <defaultValueExpression> tag and decide if you wan't it to prompt or not to prompt with the isForPrompting attribute.
Why can't we have select list, well I guess iReport is a tool for developers, so the preview is only to test the report. For customers jasper soft have developed the jasper report server.
And remember you can always develop your own interface (in swing or on the web)

Related

Crystal Reports: Set date parameter value to calculation without using a sub-report?

Is it possible to set the value of a command parameter to a date calculation i.e 2 months from the date run without putting it in a sub-report and passing the values from a main report?
You can do this either using a subreport or in the calling application. No other way. You can check this video to see how it works in an application:
http://www.r-tag.com/Pages/Preview_RTagAndBOE.aspx
Jump directly to 2:12 or select "Parameter templates" in the menu. This software has a free version, which supports the default values so if changing the application is an option for you go and get it from here:
http://www.r-tag.com/Pages/CommunityEdition.aspx
If you developed your own application you can implement similar interface.

How to output the excel with filters enabled on columns in crystal reports

I have a crystal report where I need to mail the users the data in the excel as an attachment but with the condition that filters are enabled in each columns of the excel report .
If I have 10 columns in excel , user doesn't want to apply filter explicitly rather they want the filter already present so that they can filter based on any column .
If there is another better way of filtering the data on user side please suggest that too.
There is no way to do this from within Crystal reports. You can write an application, which will export the report to Excel, open the Excel file and add a filter.
There is a free version of R-Tag, which supports this feature. You can see it demonstrated here: http://www.r-tag.com/Pages/Preview_RTagAndBOE.aspx
Use the menu to jump to "Advanced report extensions" or go to position 5:26
If this works for you, here is the link to the free edition:
http://www.r-tag.com/Pages/CommunityEdition.aspx

How to avoid selecting first value in single select list of values type mandatory input control in jasper reports

I'm using JasperReports 6.0.1. i am creating a report where one input control is single select list of values which is mandatory and i am giving three name and value pairs.
here is my parameter
<parameter name="daily_weekly_monthly" class="java.lang.String"/>
when i run my report by default first name is being selected i don't want to do that i want user to select from the drop down when he runs report. how can i achieve it? i guess there might be an attribute to put in jrxml?
You need to specify the Report unit to 'Always Prompt' for input controls.
From Repository Explorer, select your report and select 'Edit'. From here, click on the 'Controls & Resource'. Here you will see Input Control Options, where there is a checkbox named 'Always Prompt'. Check this to enable prompting all the time.

JasperReports parameters works in iReport but fails on JasperReports Server (II)

I have a very similar problem to the one described at [JasperReport parameters works in iReport but fails on JasperServer] post.
The report works properly within the iReport environment using Preview option but fails within JasperReports Server
The comments suggest that iReport does not create the InputControl within JR Server. So I verified that the server contained the proper InputControl (that apparently solved their issue).
The input control called sk serial selection :
ID: ic_sk_serial
Name: sk serial selection
Type: Single Select Query
Mandatory: false
Read Only: false
Visible: true
Query resource:
From repository (pointing to *q_sk_serial* see below)
Value and Visible columns:
Value column: id
Visible query columns: serialnr
The input control query called q_sk_serial (populate the inpute control with a list of alphanumeric serial numbers, items are unique):
select id,serialnr from "public"."serials" order by serialnr;
The parameter name:
ic_sk_serial
The report query:
select * from "public"."datas" datas where datas."serialnr" like $P{ic_sk_serial}
In my case, input control seems to work properly in both environments (within iReport preview and JasperServer): I populate a list of items coming from the same database; I see that dropdownlist as expected within iReport but also on with JR Server.
Within iReport, the drop-down list returns the correct selected value in a report parameter which lead to the correct report. In JasperReports Server I only get a "The report is empty" message. So I tend to think the report parameter is not properly passed through within JasperServer.
Hardcoding the "Input control" output value, shows expected report.
Side note: I am using iReport 4.7.1 in compatibility mode with JasperReports Server 4.5.0.
I would be glad to hear if anybody ran into the same problem?
How can I debug further the report execution in JR Server?
Is compatibility mode susceptible to cause that issue?
What about the input parameter type? I use a query that return a string. However my input data type is text (closest match to string). My parameter type is java.lang.string. Does this make sense?
Actually that is a simple bug:
I just found out that:
value column: id
Should be
value column: serialnr
Still, I do not understand why the report was working in preview mode? Such big mistake should fail on preview no?
In anycase thanks to everybody to lead to my mistake ;)
In my point of view, there are two types of parameter within a jasper report including: Report parameter and Dataset Paramter.
Firstly, you must create both parameters and then map the one of Dataset to the one of Report.
I encountered the same problem to you thus that resolved my case.

Two SQL query inside single JasperReport

We are generating reports based on iReports and JasperReports for web application.
Using iReports I found I am struck with big problem.
I want to use two SQL query to fill up my main report...
In query designer I can only write one query..
For another query I cannot use sub-reports...
How do I write second query which will return different fields and include them in my report..
Please guide...
I cannot use sub-reports...
Yes, adding a table to your report is as easy as adding a field. Just drag it from the palette and drop it in the report where you need to have it.
Add a new Table data source. I assume this was done.
Once the data source is configured, you could design your table UI using the wizard.
just click on next or finish to close the wizard.
To add a parameter in data set (if needed), Navigate to your data set using the report inspector. Expand your data set. You would find the parameters menu. Right click to add the new parameter.
Now right click on your table and select edit table data source. Here you will find options to pass parameters to your table from the main report. Passing parameters to your table should be as simple as you do in sub reports. Select the parameter just created from the drop down list box and pass the required value.
In the Data set run Dialog box that appears, please make sure of the data set and the report connection you are using.
You are done configuring the table with this, next you will place the fields in the cells of table for displaying the data.
You are getting your document has no pages since the main report query does not return any rows i guess. For your table to be executed your main report must return at least a row
Hope this helps you.
Good Luck!!
As far as Ireports are concerned, the main report can comprise only one query. And if you wanna use multiple queries in your report, it is possible in the following ways.
Sub Report
Table Dataset.
sub Dataset.
since you don wish to use a sub report, you can go for a Table Dataset. Anything you would do with a sub report is possible with table dataset too(Except for returning variables). You can use sub datasets with charts and graphs. Table set will be of use to you i hope.