Home
Analytics
Set a dynamic value from a dataset as a params default value
unknown
Hi
I have a data set :
id lb
201306 2013-T2
201303 2013-T1
201212 2012-T4
201209 2012-T3 ...
I have a params period_choice, for choosing the period in a scrollable list box pointed this dataset
I would like to put a default value on this param's which is systematicely the last value of these dataset (for exemple 201306)
Must I have a script for this or can I define it thrue a Birt function and in this case, what is the Birt function to use ?
Thanks for your help
Vincent
Find more posts tagged with
Comments
kclark
I think the easiest way to do this would be a custom parameter page. You'd have to loop through the list box and place the values in an array. Then once you have that you can select your default display value based on your logic<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>
<script>
function loop()
{
var list = document.getElementById('10');
var myArray = new Array();
for(var i = 0; i < list.options.length; ++i) {
//alert(list.options[i].value);
myArray.push(list.options[i].value);
}
// Set default value of list box here based on some logic
}
</script>
</head>
<body onLoad="loop();">
<birt:parameterPage
id="report1"
name="page1"
reportDesign="somereport.rptdesign"
isCustom="true"
pattern="frameset">
<birt:paramDef id="10" name="Name"/>
</birt:parameterPage>
</body>
</html>
</pre>
Migrateduser
Thanks kclark...I will try
Vincent