Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 131089

Summary: Allow for Multi-select combo and list boxes
Product: z_Archived Reporter: David Peterson <david_peterson4146>
Component: BIRTAssignee: 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.0Keywords: plan
Target Milestone: 2.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 199355    
Bug Blocks:    
Attachments:
Description Flags
Filter Dialog for Table none

Description David Peterson CLA 2006-03-09 09:20:07 EST
Please develop the capability allow for mutli-select (i.e. control-click) combo-box and listboxes.
Comment 1 Wenfeng Li CLA 2006-03-09 19:19:51 EST
is this enhancement for report parameter selection list?
Comment 2 Wenfeng Li CLA 2006-03-09 19:36:05 EST
*** Bug 131196 has been marked as a duplicate of this bug. ***
Comment 3 Wenfeng Li CLA 2006-03-09 19:36:43 EST
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)
Comment 4 David Peterson CLA 2006-03-10 00:21:57 EST
(In reply to comment #1)
> is this enhancement for report parameter selection list?
 
Yes.
Comment 5 Wenfeng Li CLA 2006-03-10 03:30:51 EST
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.   

Comment 6 David Peterson CLA 2006-03-10 08:54:28 EST
(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.
Comment 7 Rima Kanguri CLA 2006-03-16 13:55:55 EST
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.

Comment 8 Etienne Lacombe CLA 2006-06-14 14:02:28 EDT
Any plan for this? Target release?
Comment 9 Thibaud Raison CLA 2006-10-27 08:25:31 EDT
I'm also interested to know if this feature is planned in future release
Comment 10 Stan Jordan CLA 2007-01-07 15:11:11 EST
This is a dup of Bug 164784
Comment 11 Rima Kanguri CLA 2007-05-01 15:29:42 EDT
*** Bug 164784 has been marked as a duplicate of this bug. ***
Comment 12 Rima Kanguri CLA 2007-07-26 21:15:20 EDT
Scheduling to BIRT 2.2.1 to investigate if we can support it in this release
Comment 13 Penelope Constanta CLA 2007-08-04 13:13:24 EDT
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>
Comment 14 Rima Kanguri CLA 2007-08-08 18:46:40 EDT
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. 

 

Comment 15 Rima Kanguri CLA 2007-08-08 18:47:51 EDT
Reassigning to Aashima for UI mockups
Comment 16 Frank Zhang CLA 2007-08-22 23:19:39 EDT
GUI part has finished.
For accessibility reasons, I changed little about the mockup, and attatched the screenshot, please review.
Comment 17 Frank Zhang CLA 2007-08-22 23:23:42 EDT
Created attachment 76735 [details]
Filter Dialog for Table

This is the filter dialog for Table, and the one for crosstab is similar to it.
Comment 18 Frank Zhang CLA 2007-08-22 23:27:59 EDT
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.
Comment 19 Lin Zhu CLA 2007-08-24 04:03:38 EDT
DtE part fix has been done.
Comment 20 Mustafa Ahamed CLA 2007-09-04 18:00:58 EDT
Is this feature complete and scheduled for 2.2.1 release ? The last comment says that only DtE part was fixed. Please update.