Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Question about Cascading Parameter Group - can I add a checkbox on top of it?
jerz
Hi All,<br />
<br />
I'm using <span style='font-family: Courier New'>Cascading Parameter Group</span> functionality in my BIRT reports.<br />
<br />
Here's a problem I ran into, recently:<br />
I'm using the cascade to select countries for the report:<br />
<ul class='bbc'><li> regions (Europe, Asia, North America, etc),</li><li> countries (UK, Germany, France, USA, China).</li></ul>
<br />
However, some of these countries are larger (eg. top 10 by population - China, India, USA, Indonesia, etc) and the some are smaller (Andorra, Slovakia, etc). <br />
<br />
Sometimes, users are interested in the top 10 countries only, so I introduced a checkbox on top of the cascade parameter list, stating "only top 10". <br />
Clicking this button should narrow down the cascaded parameters - both regions and countries - to choose only from the top 10 country list. <br />
<br />
I tried to add a 3rd cascaded report parameter as a checkbox, but it seems that it's not an option.<br />
<br />
How should I configure BIRT parameters, so that clicking the checkbox narrows down the selection?<br />
<br />
I'm using BIRT 2.6.2 and Birt Viewer.
Find more posts tagged with
Comments
kclark
Hi jerz! To do something like this you would need to make you're own custom parameter page. Take a look at this example.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/birt.tld" prefix="birt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script>
function hideDiv(){
document.getElementById('div2').style.display = "none";
}
hideDiv()
function showMe (it1, it2, box) {
var vis1 = (box.checked) ? "block" : "none";
document.getElementById(it1).style.display = vis1;
var vis2 = (box.checked) ? "none" : "block";
document.getElementById(it2).style.display = vis2;
}
</script>
</head>
<style type="text/css">
.class1 { background-color:#ff0000; color: #ffffff; }
</style>
<body onload="javascript:hideDiv()">
<form>
<input type="checkbox" name="c1" onclick="showMe('div1', 'div2', this)" checked>Top 10 countries
</form>
<div id="div1">
<br>
<birt:parameterPage
id="report1"
name="page1"
reportDesign="new_report_3.rptdesign"
isCustom="true"
pattern="frameset">
Cascading Parameter1: <birt:paramDef id="5" name="Country" />
<br><br>
Cascading Parameter2: <birt:paramDef id="6" name="City"/>
<br><br>
<input type="submit" name="submit" value="Sumbit form"/>
<br><br>
</birt:parameterPage>
</div>
<div id="div2">
<br>
<birt:parameterPage
id="report2"
name="page1"
reportDesign="new_report_3.rptdesign"
isCustom="true"
pattern="frameset">
Cascading Parameter1: <birt:paramDef id="7" name="Country" />
<br><br>
Cascading Parameter2: <birt:paramDef id="8" name="City"/>
<br><br>
<input type="submit" name="submit" value="Sumbit form"/>
<br><br>
</birt:parameterPage>
</div>
<br>
</body>
</html>
</pre>
<br />
It switches between two sets of parameters. To get the top N results from your database for the top N parameters you would have to do that with an SQL statement.
jerz
Hi kclark, sorry about a late response.<br />
<br />
Unfortunately, after some testing it turned out that we will have to implement our own parameter pop-ups, perhaps with some hacking of the report page. <br />
<br />
However, just being curious, I tried to follow your scenario and BIRT's official documentation, and it turned out that some things do not work as expected. I followed this documentation: <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/viewerUsageMain.php#tags'>http://www.eclipse.org/birt/phoenix/deploy/viewerUsageMain.php#tags</a>
; and the following snippet:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<birt:parameterPage
id="report1"
name="page1"
reportDesign="new_report_3.rptdesign"
isCustom="true"
pattern="frameset">
Cascading Parameter1: <birt:paramDef id="5" name="Country" />
<br><br>
Cascading Parameter2: <birt:paramDef id="6" name="City"/>
<br><br>
<input type="submit" name="submit" value="Sumbit form"/>
<br><br>
</birt:parameterPage>
</pre>
<br />
1. Cascading doesn't seem to work at all - changing first dropdown does not reload 2nd dropdown's data,<br />
<br />
What am I doing wrong?<br />
<br />
2. Second parameter should be a multiple selection box, and it is a listbox in the default BIRT's popup.<br />
<br />
How can I make 2nd parameter a listbox?<br />
<br />
3. When I get a report preview, there's a {P} icon, which will pop the default parameter window, instead of mine - can I hide only this icon?<br />
<br />
Can I show my parameters page instead of the default one?<br />
<br />
4. I can switch off the whole toolbar, but in this case, I lose the Export button, too - which I need.<br />
<br />
Can I hide {P} icon, only?