| Summary: | Allow for Multi-select combo and list boxes | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | David Peterson <david_peterson4146> | ||||
| Component: | BIRT | Assignee: | Lin Zhu <lzhu> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | agoel, etiennel, haridasan.t, lzhu, mahamed, penelope, stan_jordan, thibaudr, vladperl, xiong.zhang, zqian | ||||
| Version: | 2.0.0 | Keywords: | plan | ||||
| Target Milestone: | 2.2.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | 199355 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
|
Description
David Peterson
is this enhancement for report parameter selection list? *** Bug 131196 has been marked as a duplicate of this bug. *** From 131196: Of course, we should also make sure that the dataset creation is user friendly in helping to create SQL for select * from table_x where columny in (a,b,c) (In reply to comment #1) > is this enhancement for report parameter selection list? Yes. This entry requires enhancement in the report viewer requester page UI, report parameter to support list type of parameters, and data set parameter support list type of parameters. (In reply to comment #5) Yes, we'd need to support Integers and Strings (lists) data types. I'm not sure if we'd need anything beyond thosee two. This enhancment will be supported in a future release.
Suggested work around is given below-
------------------------------------
1. define a report parameter Pr1 of string data type
2. define the SQL in the data set with parameter Pd1 as
“select * from xyz_table "
3. Implement the java script method beforeOpen() of the dataset to modify the query text as.
this.queryText = this.quertyText + " where c1 in ( " + params["pr1"] + ")"
4. Define a data set Dpr1 as the selection list for Pr1.
5. Use a customer jsp page to launch your report and prompt user with the selection list from Dpr1.
6. Get the multi selection from your customer jsp page and set pr1 = “v1,v2,v3,…”
7. Continue to run the report.
Any plan for this? Target release? I'm also interested to know if this feature is planned in future release This is a dup of Bug 164784 *** Bug 164784 has been marked as a duplicate of this bug. *** Scheduling to BIRT 2.2.1 to investigate if we can support it in this release In Birt 2.2 you can have your own multi selection form if you use the tag library. The following if a piece of a sample code that I have. My problem at this point is to retrieve the parameter associated with a report through the tag library...
This page sets the following report parameters:
"Start Date"
"End Date"
"VOs" --> uses the "myVOs" multiselect
-----------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="org.eclipse.birt.report.engine.api.*"
import="java.util.HashMap"
import="java.util.Map"
import="java.util.Collection"
import="java.util.Iterator"
import="java.util.Date"
import="java.text.SimpleDateFormat"
import="java.io.*"
import="java.io.FileOutputStream"
import="java.sql.*"
import="net.sf.gratia.reporting.*"%>
<%@ taglib uri="/WEB-INF/tlds/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">
<title>Gratia Parameter Entry</title>
<script language="javascript1.2" src="calendar/calendarstd.js"></script>
<script language="javascript1.2" src="calendar/calendardef.js"></script>
<script language="javascript1.2">
<!--
var c1 = new CodeThatCalendar(caldef1);
//-->
</script>
<script language="JavaScript">
<!--
function addVO (form) {
/* Construct the VOs string from the selection */
form.VOs.value = "(";
for(var i = 0; i < form.myVOs.options.length; i++)
if (form.myVOs.options[i].selected)
if (form.VOs.value != "(")
form.VOs.value += "," + "'"+ form.myVOs.options[i].value + "'";
else
form.VOs.value += "'"+ form.myVOs.options[i].value + "'";
form.VOs.value += ")";
}
//-->
</script>
</head>
<body>
<%
String report =request.getParameter("report");
// Define current date (End date) and a week ago (Start Date)
Date now = new Date();
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
String End = format.format(now);
now = new Date(now.getTime() - (7 * 24 * 60 * 60 * 1000));
String Start = format.format(now);
// Display which report we are using
%>
Report = <%= report %> <br>
<birt:parameterPage id="Param1" reportDesign="<%= report %>" isCustom="true" >
<table>
<tr>
<td>Start Date: </td>
<td><input type="text" name="Start Date" value="<%=Start %>">
<BUTTON name="cal1" value="cal1" type="button" class=button onclick="c1.popup('Start Date');">
<IMG SRC="./calendar/img/cal.gif" ALT="test"></BUTTON></td>
</tr>
<tr>
<td>End Date: </td>
<td><input type="text" name="End Date" value="<%=End %>">
<BUTTON name="cal2" value="cal2" type="button" class=button onclick="c1.popup('End Date');">
<IMG SRC="./calendar/img/cal.gif" ALT="test"></BUTTON></td>
</td>
</tr>
<tr>
<td valign="top"> Select one or more VOs:</td><td>
<SELECT multiple size="10" name="myVOs" onChange="addVO(this.form)">
<%
// define the sql string to get the list of VOs that the user can selct from
String sql = "select distinct (VO.VOName) from VO, VONameCorrection where VO.VOid = VONameCorrection.VOid order by VO.VOName";
// Execute the sql statement to get the vos
Connection con = null;
Statement statement = null;
ResultSet results = null;
String VOName = "";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (ClassNotFoundException ce){
out.println(ce);
}
try{
// con = DriverManager.getConnection(reportingConfiguration.getDatabaseURL(), reportingConfiguration.getDatabaseUser(), reportingConfiguration.getDatabasePassword());
// hardwire values for testing...
con = DriverManager.getConnection("jdbc:mysql://gratia-db01.fnal.gov:3320/gratia_itb", "reader", "reader");
statement = con.createStatement();
results = statement.executeQuery(sql);
// Loop through the SQL results to add a row for each record, we have only one column that contains the VOName
while(results.next())
{
// Get the value for this column from the recordset, ommitting nulls
Object value = results.getObject(1);
if (value != null) {
VOName = value.toString();
out.println("VOName: "+VOName);
%> <OPTION value="<%=VOName %>"><%=VOName %></OPTION> <%
}
}
}catch(SQLException exception){
out.println("<!--");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
out.print(sw);
sw.close();
pw.close();
out.println("-->");
}
finally
{
try
{
con.close();
}
catch(Exception ex) {}
try
{
statement.close();
}
catch(Exception ex) {}
try
{
results.close();
}
catch(Exception ex) {}
results = null;
statement = null;
con = null;
}
%>
</SELECT>
</td>
</tr>
<tr>
<td> Selected VOs:</td><td><input type="text" name="VOs" Value = "VO-0" readonly size="50"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" >
</td>
</tr>
</table>
</birt:parameterPage>
</body>
</html>
Below is the high level changes For BIRT 2.2.1 Enhancments to report parameter to allow mutli value support. Support the dataset filter condition to link to a report parameter Model Change: a) Add property on parameter to tell whether this parameter is multi-value. b) Support for IN operator in the dataset filter definition UI changes a) Needs to add the above new property to parameter editor dialog. b) Support IN operator in dataset filter dialog DtE changes a) Need support the dataset filter condition to reference to a report parameter with multi-value b) Support IN operator in dataset filter condition c) Support multi parameter value in java script ( Good to have, not required ) Viewer changes If the parameter is multi-value type, should update the parameter requester page to let user give the values. Engine changes Engine should provide API to accept the list of parameter values from the parameter requester page, and then pass to DtE. Reassigning to Aashima for UI mockups GUI part has finished. For accessibility reasons, I changed little about the mockup, and attatched the screenshot, please review. Created attachment 76735 [details]
Filter Dialog for Table
This is the filter dialog for Table, and the one for crosstab is similar to it.
I've added myself to CC list. If there're any proposals, please add comment, I can see it. Now I reassign this bug to DtE to finish their own part. after done, please reassign it to other team one by one. Thanks. DtE part fix has been done. Is this feature complete and scheduled for 2.2.1 release ? The last comment says that only DtE part was fixed. Please update. |