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)
How To Combine BIRT Reports
dishatto
Hello. I have several separate reports I have created- each based on the same data source but different queries. Is is possible to create a drop down list of reports the user can choose from and run any report they want? I've used parameters to be able to choose info from within one report. But can I use a parameter to enable the user to choose and run a certain report? Thanks.
Find more posts tagged with
Comments
kclark
One way to do this (see attached report) is to use a JavaScript drop down. The list in the attached report in populated by script, which might be helpful if you have a lot of reports and want to keep the names in a DB. Every time an item is selected this is run.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<script>
function populateDropDown() {
var array = <VALUE-OF>listOfCountries</VALUE-OF>;
elem = document.getElementById("dd");
for (i = 0; i < array.length; i++) {
var option=document.createElement("option");
option.text=array[i];
try {
// for IE earlier than version 8
elem.add(option,elem.options[null]);
}
catch (e){
elem.add(option,null);
}
}
}
function submit(obj) {
var selIndex = obj.selectedIndex;
alert(obj.options[selIndex].text);
if(obj.options[selIndex].text == "USA") {
window.location = "http://localhost:8080/birt/preview?__report=test.rptdesign"
}
}
</script>
</pre>
<br />
The selection is shown in a popup box and later in the script what item has been selected is checked. If the selection equals USA then you are redirected to a new report. In my evironment I'm running BIRT inside tomcat which is why I redirected to <a class='bbc_url' href='
http://localhost:8080/birt/preview?__report=test.rptdesign..I'>http://localhost:8080/birt/preview?__report=test.rptdesign..I</a>
; only did an if/then for USA to show how it can be done. The other selections will only prompt the country. Let me know if this helps.