In our requirment I have to populate two rows of a datagrid through a query,one of them is getting populated.The problem with the other one is that its a dynamic query,the part of query after "select" in turn comes from selecting multiple selections from a listbox.
My Code In java is:
String []selectedValues=null;
ListBox attributeListBox = (ListBox) getControl("List",ListBox.class);
attributeListBox.setMutable(true);
String Actname = attributeListBox.getElementName();
System.out.println("Actual Name of ListBox is:"+Actname);
PageContext pc=getPageContext();
HttpServletRequest req=(HttpServletRequest)pc.getRequest();
String s[] = req.getParameterValues(Actname);
StringBuffer buff=new StringBuffer();
for (int i=0;i<s.length;i++)
{
System.out.println( "Sel val are:"+s[i]);
if(i !=(s.length-1))
buff.append( s[i]+ ",");
else
buff.append(s[i]);
}
System.out.println("Values for Query are:"+buff.toString());
String sqlPropertList=("select "+buff.toString()+" from "+strTransType+" where r_object_type ='"+strTransType+"'");
System.out.println("Query sqlPropertList is:" +sqlPropertList);
Datagrid datagrid=(Datagrid) getControl("mainDoc",Datagrid.class);
datagrid.getDataProvider().setDfSession(getDfSession());
datagrid.getDataProvider().setQuery(sqlPropertList);
datagrid.getDataProvider().refresh();
datagrid.getDataProvider().initBind();
("strTransType" comes from another query)
In JSP I added :
<dmf:datagrid name="mainDoc" paged="true" pagesize="29" query="sqlPropertList">
But still in webtop its displaying "query Error has occured".
Please give your thoughts & help me in this.
Thanks in advance