Drop Elements Depending on Output Format
Posted by
mwilliams
, 08 March 2013 - 06:34 PM
if(reportContext.getOutputFormat() == "xls"){
reportContext.getDesignHandle().findElement("elementName").drop();
}
This works as you would expect, for most outputs. However, when you try this for pdf, while it does drop the correct element when you run the report in pdf, it also drops the element when you run the report in the web viewer. This is because getOutputFormat returns pdf when you run your report with the web viewer.
Luckily, there is a way around this. You also have access to the HttpServletRequest, so if you use a script like the following, in your beforeFactory, the correct format will be returned.
if(reportContext.getHttpServletRequest().getAttribute("attributeBean").format == "pdf"){
reportContext.getDesignHandle().findElement("elementName").drop();
}
With this method, we now see that the web viewer is actually HTML and the correct element is dropped from the report.
This solution will only work in open-source BIRT, as the HttpServletRequest is not available in the commercial version. The sample report used in this post can be downloaded here.
Last week in the Forums: Scroll Bars on a Chart, Line Height Issue in PDF, and more...
Posted by
mwilliams
, 25 June 2012 - 07:05 AM
The unanswered post, this week, is about scroll bars on a chart. The poster has a gantt chart that they want to have vertical scroll bars on. If anyone has done this or has ideas, please post your suggestions in the thread.
The next topic, for this week, is about line height in PDF. This question comes through the forums often enough. When you set the line height in BIRT to a larger value than the text, all outputs show a larger line height. However, when you try to have a smaller line height, the HTML outputs show this, but PDF does not. The reason that some people tried to reduce the line height was because PDF seemed to show extra spacing between lines. This should be solved in BIRT 3.7, as there is a new line height algorithm for 3.7+. So, if you're using an older version and having issues with line spacing, upgrading will be the easiest option. The next option is probably to edit the pdf emitter.
The last topic, for this week, is about passing multiple values to a report through a parameter. The poster had a HTML select form in their report in a HTML text box that they wanted the user to be able to select multiple values from and submit the form and recall the design passing the multiple selections through their parameter. A sample report is included in the thread that does just that. It passes the current values through the parameter and uses them in the query to limit the dataSet. It also sets them as the selected values in the drop down.
Again, this is just a small sample of what went through the forums this past week. For more questions and answers that have been posted, check out the forums. As always, if you have a question, feel free to ask it, and if you see a question you know the answer to or have a similar experience to, feel free to post an answer or comment.
Last week in the Forums: "Processing" Bar for PDF Reports, Stacked Bar Chart "Total" Label, and more...
Posted by
mwilliams
, 09 April 2012 - 06:49 AM
The unanswered post, from last week, that I'll discuss is about adding a processing bar when generating a PDF report. The poster is wanting to know if there's a way in which they can add a "processing, please wait" bar to let the user know the PDF is still processing. If anyone has experience with this issue or has a suggestion to something that could work, please post in the forum thread!
The next post I'll cover, this week, is about putting the total on top of a stacked bar chart. The poster was wanting to find a way to show the total bar value in a label on the top of a stacked bar, rather than just the individual stacked bar values. An example report design is posted in the thread that shows how script can be used to achieve this, by hiding the label for the bottom series and changing the value of the top series's label to be the sum of the bar.
The last topic we'll cover, from last week, is about truncating a long URL, but keeping the hyperlink. The poster was wanting to know how they could truncate a long URL in their table, for clean design purposes, but still keep the value of the entire URL for the hyperlink. One way to do this is given in the forum thread. It is to use the following script:
var myaction = this.createAction(); myaction.setHyperlink(this.getValue(),"_blank"); this.action = myaction; this.setDisplayValue(this.getValue().substr(0,20));
Again, this is just a small sample of what went through the forums this past week. For more questions and answers that have been posted, check out the forums. As always, if you have a question, feel free to ask it, and if you see a question you know the answer to or have a similar experience to, feel free to post an answer or comment.
Last Week in the Forums: SVG Images in PDF, Dropping a Series from a Chart, and more...
Posted by
mwilliams
, 12 December 2011 - 04:18 AM
The unanswered question for this week is an issue with SVG in PDF. The question is, when a SVG image is created with Adobe Illustrator, it works in the PDF. However, when the SVG is made with Inkscape, they receive an error message like, "Current report item is not supported in this report format." If anyone has experienced this issue with SVG images and PDF, please post your suggestions or solution in this thread!
The next post I'll cover from last week is, dropping a series from a chart. The question was, how do you drop a series from a chart if it's an empty series. A devShare post is linked as an answer. The devShare post shows how to drop a series based on a parameter. So, the only work left to do to solve the poster's question is to determine if the series is empty or not. This can probably be done outside the chart and passed in just like the parameter value in the example. This information can also probably be found out in the afterDataSetFilled function in the chart script.
The last topic for this week is, changing negative numbers to red. The question is, if you have a field of positive and negative numbers, how do you make the negative ones red. The solution provided is to select the data element for the field, and go to the highlight section of the property editor and add a highlight rule.
Again, this is just a small sample of what went through the forums this past week. For more questions and answers that have been posted, check out the forums. As always, if you have a question, feel free to ask it, and if you see a question you know the answer to or have a similar experience to, feel free to post an answer or comment.
Recent Entries
Plug In 2 BIRT Contest - Spring 2013 Ends Soon
Creating Derived Cube Measures and More with BIRT and ActuateOne
Drop Elements Depending on Output Format
Solving a TOC Bookmark Issue by Using Multiple Fields in a Single Group Expression
Visualizing the Impact of Database Changes with BIRT and ActuateOne
Actuate's 11SP4 Release Provides Many Powerful New Capabilities, Including HTML5 Charts and more!
Getting a Marker in the Middle of a Gantt Chart Bar, Multi-Level HTML List Numbering, and more...
Switch to a Default Table if no Values Returned in Query, Parameterize the From Portion of an SQL Query, and more...
Adding Text to an Image, Using Table Data for a Crosstab's Data, and more...
My Blog Links
Recent Comments
- mwilliams on Drop Elements Depending on Output Format
- donino on Drop Elements Depending on Output Format
- mwilliams on Creating a BIRT report as a calendar view
- lnallamalli on Creating a BIRT report as a calendar view
- For Birt on Last Week in the Forums: BIRT and R Statistical Language, Specified Sort Order for a Table, and more...
- Bhanwar on Last Week in the Forums: Filtering Blank Spaces from Distinct Count Aggregation, Adding a Line at 0 in a Chart with Negative Values, and more...
- Srividya Sharma on Sorting a Crosstab by a Field Not Displayed in the Crosstab
- mwilliams on Last Week in the Forums: Using the Concatenate Aggregate, Hiding a Column When There is No Data, and more...
- java032 on Last Week in the Forums: Using the Concatenate Aggregate, Hiding a Column When There is No Data, and more...
- java032 on Last Week in the Forums: Using the Concatenate Aggregate, Hiding a Column When There is No Data, and more...
0 user(s) viewing
0 member(s)
0 anonymous member(s)
Categories
- .rptdocument
- 11 SP4
- Actuate
- ActuateJavaComponent
- ActuateOne
- aggregating data
- aggregation
- alignment issues
- Alternating Highlight
- archived BIRT versions
- area chart
- axis label
- barcodes
- batch file
- BDPro
- BIRT
- BIRT Exchange
- BIRT functions
- BIRT Studio
- BIRT-Exchange
- bookmarks
- border
- border color
- bursting
- calendar
- cascading parameter
- CEAPI
- cell border
- chart
- charting
- charts
- client side script
- color
- color codes
- command line
- computed column
- connection profile
- contest
- crosstab
- CSS
- CSV
- CSV export
- custom group
- custom sort
- Data Analyzer
- data cube
- Data Object
- data point label spacing
- data row security
- data set filter
- data set parameters
- dataset parameters
- Date Format
- deapi
- deploy
- devShare
- display name
- drop
- drop series
- dynamic chart
- dynamic chart labels
- dynamic chart marker
- dynamic chart scale
- dynamic chart title
- dynamic column sort
- Dynamic Column Visibility
- dynamic data set
- dynamic grid content
- dynamic grouping
- dynamic labels
- dynamic min/max
- dynamic scale
- Dynamic Text
- Dynamic Width
- Eclipse
- elapsed time format
- embedded grid
- empty csv error
- Event Handlers
- exception handling
- export data
- expression builder
- filter
- Firefox
- flash map
- Forum
- Forums
- fragmented schema
- gantt
- gantt chart
- global function
- GMT date
- grids
- group numbering
- grouping
- hide label
- hide measure detail
- hide series
- Hierarchy
- hierarchy report
- highlight
- highlight negative numbers
- HTML
- HTML listbox
- html lists
- HTML select form
- HTML Table
- HTML5
- https
- hyperlink
- image
- Impact Analysis
- Import Elements
- Ineractive Viewer
- Information Objects
- Interactive Viewer
- invalid dates
- iServer
- JAX-WS
- joint data set
- jquery
- jsapi
- JSF
- JSP
- legend
- legend color
- Library
- line height
- locale
- localization
- marker range color
- master page
- masterpage
- Maximo
- merge data
- multi-line text
- multi-select parameter
- multi-select parameters
- multi-value parameter
- multiple series
- NetWeaver
- newspaper
- newspaper layout
- optional y-series grouping
- osgi
- overlaying elements
- page break
- parameter
- parameters
- parameters in query
- PDF Complete
- Perl
- Pie Chart
- plug-in
- postgresql encoding issue
- progress bar
- property file
- R Statistical Language
- refresh report
- relative path
- reorder table
- report engine
- report viewer title
- reporting
- Reports
- Rolling Sum
- rotated text
- rptdesign
- rptlibrary
- runtime
- scatter plot
- script
- scripted dataset
- scroll bars
- Seam
- secure connection
- series color
- series name
- session variable
- sort
- Sort Order
- SP4
- special characters
- SQL
- SQL injection
- stacked bar
- stored procedure
- Styles
- Sub Report
- summing values from two different elements
- SVG
- tabbed report
- table
- table footer
- Themes
- TOC
- TOC with page numbers
- tomcat
- Tooltip
- transient report cache
- truncated text
- user parameters
- Vaadin
- value-of format
- version features
- Viewer
- viewer title
- visibility
- Web Service
- web viewer
- Webshpere
- Word
- xls
- XML data source


