optional parameter in birt report

i had working with more optional parameter like country,state,city and i have wrote some script in before open but its not working ...

before open::

if (params["productline"].value && params["country"].value)
{
q1=this.queryText = this.queryText + " AND PRODUCTLINE = '" + params["productline"].value +"'"+" and COUNTRY = '" + params["country"].value + "'"+"group by country"; 

reportContext.getDesignHandle().findParameter("state").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();
Packages.java.lang.System.out.println ("Query1:" +q1);  

}
else if (params["productline"].value && params["state"].value)
{

q2=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and state = '" + params["state"].value + "'"+ " group by state";

reportContext.getDesignHandle().findParameter("country").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();

Packages.java.lang.System.out.println ("Query3:" +q2);  
}
else 
{
q3=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and city = '" + params["city"].value + "'"+ " group by city";
Packages.java.lang.System.out.println ("Query3:" +q3);  
reportContext.getDesignHandle().findParameter("state").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();

}

Answers


if you are having the screenshots provided by the below link1 link2 then you have to do a simple logic in your javascript like this var rptFlag = "" if counrty is selected then assign rptFlag = 'country' if state is selected then assign rptFlag = 'state' if city is selected then assign rptFlag = 'city' pass this as a rptFlag parameter to the report and in before open

you have to check like this...

if (params["rptFlag"].value=='country')
{

 /* your query  */

}
else if (params["rptFlag"].value=='state')
{

/* your query  */
}
else 
{
/* your query  */

}

Need Your Help

Vagrant shared/synced folders permissions

symfony permissions vagrant virtualbox

From my research I understand that VirtualBox synced folders have permissions set up during the mounting process. Later, I am unable to change it therefore permissions for the whole synced folder M...

MSDN documentation error? ScriptManager.RegisterStartupScript does not execute for every asynchronous postback

asp.net .net asp.net-4.0 msdn scriptmanager

According to MSDN, the ScriptManager.RegisterStartupScript method, (Page, Type, String, String, Boolean) overload, registers a script for "every asynchronous postback with the ScriptManager control...