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}]]></textFieldExpression> <hyperlinkParameter name="_report">
<hyperlinkParameterExpression><![CDATA["jrepo:/ca_ppm/ReportsCustom/subReports/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/subReports/ResourceCapacityGridByProjectReport&decorate=no'" +","+"\'\'"+","+"\'height=480,width=950,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no\'"+"));"
Related
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’.
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>
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).
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.
I'm trying to load a list of news from a website, so first I make a request to fetch the news (with the thumbnails), and using the Binding feature, I assign the Fetched news to my list box, which contains the image (ImageUrl).
<ListBox Name="lstNews">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,12,12" Width="180" Height="180">
<Grid.Background>
<ImageBrush ImageSource="{Binding ImageUrl}" />
</Grid.Background>
<StackPanel Background="#AA000000" VerticalAlignment="Bottom" Height="60" >
<TextBlock TextWrapping="Wrap" VerticalAlignment="Bottom" TextAlignment="Center" Text="{Binding Title}" />
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
It works fine, but the UI freezes until the images show up. how can I fix that?
Actually, BitmapImages by default do load on the UI thread, which would cause the blockage. In your xaml, you should be able to do something like:
<ImageBrush>
<ImageBrush.ImageSource>
<BitmapImage CreateOptions="BackgroundCreation" UriSource="{Binding ImageUrl}"/>
</ImageBrush.ImageSource>
</ImageBrush>
Making sure to specify BackgroundCreation for the CreateOptions. For more information, I personally found this blog post to be quiet useful.
Have you tested to make sure that your UI does not freeze when you comment out your ImageBrush line? I believe the automatic conversion creates a BitmapImage from your ImageUrl, which normally loads on a background thread, so your UI thread should not block. It is possible that something else altogether is blocking the UI, like excessive amounts of text that needs to be laid out or your data layer code that feeds the list with the data.