Hyperlink in jasper reports across subreport - hyperlink

I want to add hyperlinks to my report. The hyperlink set in one report should take me to another subreport. Could you please tell me if this is feasible. If it is could you please provide step by step approach to achieve this?

First, yes, it is feasible.
Second, here are your step-by-step instructions:
Right click on element you want to link from and select
Hyperlink.
Choose Hyperlink target: Blank
Choose Hyperlink type: Reference
In the reference tab, type the url to invoke the
subreport (with parameters). For example, in one of my reports I
call the ReportController servlet to create the subreport, like so:
"./ReportController?reportName=ValidationDetailsChart&reportTitle=Validation%20Details&nParms=3&parmName_1=ORD_NUMBER&parmValue_1=" + $F{ORDER_NUMBER} + "&parmName_2=START_TIME_MS&parmValue_2=&parmName_3=END_TIME_MS&parmValue_3="
Add a tooltip in the Tooltip tab (optional). Note you can reference variable and paramter values in the tooltip.
Note that there are other ways to do this, and your method may vary if you aren't using java and servlets to generate your reports. I would recommend looking at the ireport documentation for further instructions.

I got the solution to my problem. I had no requirement where I had to to pass any value from one subreport to another. So I simply right clicked on the textfield that I wanted the link on. I set the Hyperlink target as "Self" and Hyperlink type as "LocalPage" and in Hyperlink Page expression I set the following expression : Integer.valueOf(i) ,where i is page number(in my case it was sheet number) where I want the hyperlink to take me. If you want you can also use the following property : Integer.valueOf($V{REPORT_COUNT}).
Thanks everyone for the response.

For navigation within reports I have implemented using Hyperlinks and Anchors
Below is the text field with hyperlinkAnchorExpression, this will be the link.
Note the hyperlinkType="LocalAnchor"
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="80" y="0" width="80" height="20" forecolor="#3286C7" uuid="9a8313d2-21f3-4cd2-8e40-f9cddeb3cdaf"/>
<box topPadding="3" leftPadding="3">
<topPen lineWidth="0.2"/>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="0.2"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement>
<font isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{cAddress}.getId()]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{cAddress}.getId().toString()]]></hyperlinkAnchorExpression>
</textField>
Below is the anchornameexpression, this will be called when a hyperlink is clicked and values is matched with the hyperlinkAnchorExpression value anywhere in the report.
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="80" y="0" width="80" height="20" uuid="9a8313d2-21f3-4cd2-8e40-f9cddeb3cdaf"/>
<box topPadding="3" leftPadding="3">
<topPen lineWidth="0.2"/>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="0.2"/>
<rightPen lineWidth="0.2"/>
</box>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
<anchorNameExpression><![CDATA[$F{id}.toString()]]></anchorNameExpression>
</textField>
I have implemented this to navigate across reports and subreports.
Hope this will be helpful.

Related

Populating ListBox in wix installer

I have created a ListBox in my wix project and i want to populate that ListBox with values coming from the custom action. What i want is that on click of a button my custom action should get called and further my ListBox should get populated. I don't know what is going wrong. So, if anyone knows how to do it, please help. Thanx in advance.
Code in My Custom Action:-
Database db = session.Database;
string var = db.Tables["ListBox"].SqlInsertString + "TEMPORARY";
Microsoft.Deployment.WindowsInstaller.View var2 = db.OpenView(var);
var2.Execute(new Record(new object[] {"PROPERTY NAME", 5, "5", "value"}));
var2.Close();
Code in Wix project:-
<Control Id="ANY ID" Property="PROPERTY NAME" Type="ListBox" X="20" Y="20" Width="300" Height="300" Sorted="yes">
<ListBox Property="PROPERTY NAME">
<ListItem Text="[PROPERTY NAME]" Value="[PROPERTY NAME]"/>
</ListBox>
</Control>
Code on Button for Calling Custom Action and refreshing value of property that is set on ListBox:-
<Control Id="ANY ID" Type="PushButton" Text="[Next]" Height="200" Width="200" X="160" Y="160" Bitmap="yes" FixedSize="yes" Default="yes">
<Publish Event="DoAction" Value="CustomAction">1</Publish>
<Publish Property="PROPERTY NAME" Value="[PROPERTY NAME]" Order="2">2</Publish>
</Control>
After all this, I am not able to see the value that is being inserted to the table in CustomAction or in other words, the ListBox is not getting populated after doing all this.
It will not work this way.
We have to call the Custom Action On load of the next dialog.
This works for me:-
<InstallUISequence>
<Custom Action="NAME_OF_CUSTOM_ACTION" Before="DIALOG_NAME_ON_WHICH_YOU_WANT_TO POPULATE_THE_LISTBOX"/>
<Show Dialog="DIALOG_NAME_ON_WHICH_YOU_WANT_TO POPULATE_THE_LISTBOX"
After="PREVIOUS_DIALOG_NAME"/>
</InstallUISequence>

Why does hyperlink in PDF not work on smartphones?

I'm generating PDF reports using Jasper reports and I have hyperlink in generated file that doesn't work on smartphones when I open it using Adobe Acrobat Reader.
Code to create the hyperlink
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement mode="Opaque" x="450" y="80" width="100" height="20" forecolor="#0080FF" uuid="d11cac12-8769-450c-b9e8-f512179f33e3">
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} == 1]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left">
<font size="10" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA["Go"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["https://www.google.com"]]></hyperlinkReferenceExpression>
</textField>
In Jaspersoft Studio, set the Link Target to ‘self’, it works for me. The Link Type is ‘Reference’.

execute drill down jasper report in pop up JasperReports Server

How to execute drill down sub report as a pop up in the same window?
Now it is drilling down in the same window of JasperReports Server.
Below is the code :
<textField hyperlinkType="ReportExecution">
<reportElement mode="Opaque" x="0" y="0" width="60" height="20" forecolor="#2471D6" uuid="dcbcfbd0-98a4-4c94-a7a5-01ff9bff8db8"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <font isUnderline="true"/> </textElement>
<textFieldExpression><![CDATA[$V{resourceunique1}]]></textFieldExpressio‌​n> <hyperlinkParameter name="_report">
<hyperlinkParameterExpression><![CDATA["jrepo:/ca_ppm/ReportsCustom/sub‌​Reports/ResourceCapacityGridByProjectReport"]]></hyperlinkParameterExpression>
</textField>
I need pop up in the parameter "_report" can I directly give the javascript inside the "_report" parameters expression. If so, can you please lead me to achieving it
You can open a report in a popup window by filling in the Hyperlink tab in Jaspersoft Studio with these values. Note you need add your server URL:
Link Target: Self
Link Type: Reference
Hyperlink Reference Expression: "javascript:void(window.open("jasperserver-url/flow.html?_flowId=viewReportFlow&reportUnit=/public/Resources/Reports/ca_ppm/ReportsCustom/sub‌​Reports/ResourceCapacityGridByProjectReport&decorate=no'" +","+"\'\'"+","+"\'height=480,width=950,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no\'"+"));"

Jasper Reports - set hyperlink to open other report and transmit collection type parameter

Can this be done? I have tried but parameter is not transmitted. Only the first selected value appear in generated link and then in the report i am opening when clicking hyperlink, I get null value.
Thanks
jrxml hyperlink code:
<textField hyperlinkType="RemotePage" hyperlinkTarget="Blank">
<reportElement uuid="1e57b233-2612-4956-8808-070dc9bcb2f5" x="548" y="30" width="222" height="17"/>
<textElement textAlignment="Right"><font size="12"/> </textElement>
<textFieldExpression><![CDATA["RawData >> Click Here"]]></textFieldExpression>
<hyperlinkTooltipExpression><![CDATA["Click to view RawData"]]></hyperlinkTooltipExpression>
<hyperlinkParameter name="_report">
<hyperlinkParameterExpression><![CDATA["repo:/Team_Reports/CIR_RawData"]]></hyperlinkParameterExpression>
</hyperlinkParameter>
<hyperlinkParameter name="Project_Sets2">
<hyperlinkParameterExpression><![CDATA[$P{Project_Sets}]]></hyperlinkParameterExpression>
</hyperlinkParameter>
</textField>

Grails Jasper Subreport

I am using grails and I have this Jasper report with a subreport in it.
Having this simple two jasper reports
Note: Only .jrxml is the file extension of the files inside the /web-app/reports
Main Report [main_report][subreport area]
<subreport>
<reportElement x="0" y="0" width="555" height="157"/>
<subreportExpression>
<![CDATA[$P{SUBREPORT_DIR} + "test_report.jasper"]]>
</subreportExpression>
</subreport>
Test report [test_report][title.band]
<staticText>
<reportElement x="203" y="30" width="154" height="34"/>
<textElement/>
<text><![CDATA[Hello World]]></text>
</staticText>
And looking in the view or the gsp file I have this command
<g:jasperReport jasper="main_report"
format="pdf, html"
delimiter=" "/>
When I want to view the report in either PDF of HTML format, the report returns a blank page. Am I missing something to display the main_report properly with a subreport test_report.
You need to:
Make sure the sub-report is compiled (do this in iReport), i.e. there should be a .jasper file for sub report in reports dir.
Set the SUBREPORT_DIR parameter before generating the report, e.g.
params.SUBREPORT_DIR = servletContext.getRealPath('/reports') + "/"
(assuming the compiled subreport is in the <app>/web-app/reports directory, the same as the uncompiled reports).

Resources