Mark Report everytime it prints (preview) in JasperSoft iReport - jasper-reports

Is it possible to mark a report based on the times we click Preview?
For example, if we preview the report once, it will show 1.
If we preview the report twice, it will show 2.
I am using Adempiere and would like to put the report inside the window. So, when I click 'Print' once, it will show 1, the same when I click Print for the second time it will show 2, etc.
Any suggestion will be useful :)

There is a field in the AD_Process table called Statistic_Count which function is to store how many times the process has been run.
What I would do is to pass the value of that field as a parameter to the report, so you can print it.
In the process parameter you could add a new numeric parameter called PreviewTimes and in the DefaultValue field set something like:
#SQL=SELECT statistic_count FROM AD_Process WHERE AD_Process_ID = #AD_Process_ID#
Then, in the Jasper Report you receive that number and include it.
Hope it helps.

Related

How to link an Input Control to a report's Parameter

I'm unable to link an Input Control to my report's Parameter. I feel I'm doing right, but I can't see the desired result in the final report.
My intention is to create a list, filled by some options, and display the list in a report as a parameter, so the user can (multi)select the options. As far as I know, I must create an Input Control on the server, create a Parameter on the report using the same name between the Input Control and the Parameter.
I've created a List of Values named ListaCalificaciones as follows:
Then, this is the Input Control:
Finally, this is the parameter:
However, when it comes to show the report on Jasper Server's web interface, I can't see a filled input:
Am I missing something?
By the way, I'm using Jasper Studio 6.6.0 and Jasper Server 7.1.0 (compiled version 20180504_1307).
Edit 2018/10/05 13:04
I've changed the input control, so that the id is ic_calificaciones and the name stays as it was (Calificaciones). I've found a way to make it work. First, I deploy the report to my server (local server in my case). Then, I edit the report, go to "Controls and resources", remove the ic_calificaciones parameter and add a InputControl parameter to the report. That way the Calificaciones parameter gets filled up with options.
I found the solution, it was just in front, but due to a poor UI I just didn't realise...
You must edit your parameter's name to match the Input Control's name, in my case it ought to be ic_valoracion. Then, the parameter-to-input-control-binding has to be made when publishing the report to the server.
So, being in Jasper Studio, click on publish button, as seen in the following picture:
Now, select the location where to publish the report. Then, the second step is what we're looking for, it's the place where you must select the resources to publish. As seen in the next image, you must edit your parameter's type to select "Link To Resource", click on whichever place and a new prompt will appear. Now, there, select the desired Input Control.
Finally, test your report.

Display Jasper report file name

I'm creating a jasper report using iReports 5.2.0 and I want to display the report file name in it.
Can't find any variable that has that information and I would like to get an alternative to pass it in the parameters.
How can I do it?
When you design your report, make a new PARAMETER named, for instance: NAME_REPORT.
After that, put a TextField in your report, for example, in your Title section, and
put as value of your TextField the parameter like a expression: $P{NAME_REPORT}
When you preview your report, ask you to give a value to this parameter and then, you see the title with the name
of your report file.
In your java code you will do somethink like that:
parameters.put("NAME_REPORT", "myreport.jrxml");
.....
JasperFillManager.fillReport(report, parameters, connection)
.....

How to display the report without applying the input values in the jasperserver for the first time

I have published a report from iReport to jasperServer with cascading parameteres.
I have set default values to cascading parameters.
While running the report in jasperserver it is asking "You must apply input values before the report can be displayed."
Is it possible to display the report first time with the passed default parameter values without applying anything.
Then if i need i will change any value and click the apply button, the value will come respectively.
Please suggest. Thanks in Advance.
Go to JasperReport server (like http://localhost/jasperserver/)
Edit the report (Manage Server -> Repository -> select you report -> click Edit button)
Open Controls & Resources tab
Uncheck Always prompt option, and give default values in iReport parameters.

ActiveReports 7 TextBox/List Page Break

I'm new to ActiveReports 7, I have a rdlx Report using a stored procedure to populate multiple lists with TextBoxes. The data is appearing correctly, however I am unable to get the TextBoxes to break when their contained data exceeds the length of the page. Instead, the TextBox remains unbroken and starts on the next page leaving a large empty gap. I have the containing Lists' 'KeepTogether' property set to 'False' and it doesn't help. How can I make these Lists and/or TextBoxes break at the end of the page and resume on the next?
Check the type of report you have. There are the "ActiveReports 7 Page Report", aka FPL (Fixed Page Layout) report and the "CPL Report" (Continuous Page Layout).
Fixed Page Layout is for creating a new page for each record. Suitable for invoices and similar reports. You need a "CPL report" so that it only adds pageas as needed for the content.
To get a CPL Report take the following steps from inside the designer in Visual Studio:
Project > Add New Item
Choose the "ActiveReports 7 Page Report" item here.
Choose Report > Convert to CPL Report.
Those steps should effectively have the effect of changing "Page" to "Body".
Below are the steps I used to create a CPL report that has a list with a textbox containing very long text (longer than a page) and it renders across pages okay:
Add a list
Add a textbox to the list. The default properties should work fine, but the relevant properties on my textbox are:
TextBox.CanGrow=True
TextBox.WrapMode=WordWrap
List.KeepTogether=False: Although technically this should be fine either way if the textbox/list are larger than a page. KeepTogether=False will just prevent it from moving to a new page if it is starting half way down the page.
Let me know if you still don't crack it and I'll upload my test report here somewhere for you.

Programmatically show link to another report in Report Builder 3.0?

I have a grouping in my report that I want to use to link to another report. My dilemma is that I only want the link to be clickable when the value in the cell fulfills a certain criteria (number > x for example). If the condition isn't true, then I don't want the cell to be clickable. Is there a way to do this?
Edit: I've tried to set an IIF statement as part of the url, but what do I link to in the "false-part" of the statement? Using "" actually just refreshes the report, which isn't really what I want either. It also complains when I tried about:blank saying the url must start with http:// etc.
Use Nothing keyword in iif expression as false part. If Nothing is specified for Action than no link will be created.
=iif(YOUR_CONDITION, "Other Report", Nothing)
An action isn't dynamic so there's no way to turn it on and off based on a condition. But the expression you use to open another report can use an expression - whether you are using jump to report or the jump to URL action. One thing you might consider is for the condition when you don't want to jump to the other report is to jump to the same report. That is, let's say you are on Report A and you want to jump to Report B only when number > x. Then you use the expression:
=iif(number > x, "Report B", "Report A")
Report A will be cached so the net effect is that you didn't click even though the user can see the cursor change to a hand and can in fact execute a click.