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)
Hide parameter based on result from dataset
Erebel55
I have a dynamic parameter that shows the IDs returned from a dataset. However, if the dataset only returns one ID I would like the parameter to be hidden and this ID used.
In other words it doesn't make sense to prompt the user when their is only one ID to choose from. Is there some way to hide the parameter and default it to the one ID returned by the dataset?
Thanks
Find more posts tagged with
Comments
kclark
You could create a custom parameter page. Then write a javascript function to check how many values are in the parameter listbox. Then check to see if the number == 1, if so you would then redirect to the report otherwise do noting and let the user select a value.<br />
<br />
parampage.jsp<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>
<script>
function getCount() {
var countSelected = document.getElementById("7").options.length;
if(countSelected == 1) {
var currentValue = document.getElementById("7").value;
var url = "http://localhost:8080/birt/frameset?__report=new_report.rptdesign&customerNumber=" + currentValue;
window.location = url;
}else{
// Do nothing or implement some other logic
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body onLoad="getCount();">
<birt:parameterPage id="birtParmPage" reportDesign="new_report.rptdesign"
name="my form"
pattern="frameset"
height="600"
width="800"
format="html"
title="My Viewer Tag"
isCustom="true"
showTitle="true"
showToolBar="true"
showNavigationBar="true"
>
Customer ID
<birt:paramDef id="7" name="customerNumber"/>
<br><br>
<input type="Submit" value="Run Report">
</birt:parameterPage>
</body>
</html></pre>
Erebel55
Thanks this looks great