Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » multiple listbox parameter trouble(any help is greatly appreciated)
multiple listbox parameter trouble [message #497959] Fri, 13 November 2009 15:02 Go to next message
jlhernan is currently offline jlhernanFriend
Messages: 13
Registered: November 2009
Junior Member
Hi, im pretty new to BIRT so maybe somebody here can help me out.

I want it so that when the parameters prompt comes up for my report, a user can choose one or more tables to view from a listbox and whichever ones are not selected are not viewed on the report. So my report currently has three data sets and three tables (one for each).

I had it working when it was a single value drop down box, but it doesn't work when i enable multiple values. I am using a report parameter and a script on beforeFactory to do all this. Here is the script:

ExhaustLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "exhaustLocations");
NoRestockLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "noRestockLocations");
DynamicLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "dynamicLocations");

if (params["rprmTable"].selected == "Exhaust Locations")
{
NoRestockLocationsTable.drop();
DynamicLocationsTable.drop();
}
else if (params["rprmTable"].selected == "No Restock Locations")
{
ExhaustLocationsTable.drop();
DynamicLocationsTable.drop();
}
else if (params["rprmTable"].selected == "Dynamic Locations")
{
ExhaustLocationsTable.drop();
NoRestockLocationsTable.drop();
}
else if (params["rprmTable"].selected == "Exhaust Locations" && "No Restock Locations")
{
DynamicLocationsTable.drop();
}
else if (params["rprmTable"].selected == "Exhaust Locations" && "Dynamic Locations")
{
NoRestockLocationsTable.drop();
}
else if (params["rprmTable"].selected == "No Restock Locations" && "Dynamic Locations")
{
ExhaustLocationsTable.drop();
}

Am i on the right track? Any help is apppreciated.
Note: I already tried .value, doesnt work either.
Re: multiple listbox parameter trouble [message #497996 is a reply to message #497959] Fri, 13 November 2009 16:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You are on the right track, you just need to iterate over the parameter
choices.

var keepExhaust = false;

var parmcount = params["rprmTable"].value.length
for( i=0; i < parmcount; i++ ){
//either switch on the parameter or if else
//to get the parameter value use
//params["rprmTable"].value[i]
if( params["rprmTable"].value[i] == "Exhaust Locations" ){
keepExhaust = true;
}

}

//now do the drops

if( !keepExhaust ){
ExhaustLocationsTable.drop();
}
//do the same for all the other tables


Also you can use repoortContext.getDesignHandle().findElement() now.

Jason

juan436585@yahoo.com wrote:
> Hi, im pretty new to BIRT so maybe somebody here can help me out.
> I want it so that when the parameters prompt comes up for my report, a
> user can choose one or more tables to view from a listbox and whichever
> ones are not selected are not viewed on the report. So my report
> currently has three data sets and three tables (one for each).
> I had it working when it was a single value drop down box, but it
> doesn't work when i enable multiple values. I am using a report
> parameter and a script on beforeFactory to do all this. Here is the script:
>
> ExhaustLocationsTable =
> reportContext.getReportRunnable().designHandle.getDesignHand
> le().findElement( "exhaustLocations");
> NoRestockLocationsTable =
> reportContext.getReportRunnable().designHandle.getDesignHand
> le().findElement( "noRestockLocations");
> DynamicLocationsTable =
> reportContext.getReportRunnable().designHandle.getDesignHand
> le().findElement( "dynamicLocations");
>
> if (params["rprmTable"].selected == "Exhaust Locations")
> {
> NoRestockLocationsTable.drop();
> DynamicLocationsTable.drop();
> }
> else if (params["rprmTable"].selected == "No Restock Locations")
> {
> ExhaustLocationsTable.drop();
> DynamicLocationsTable.drop();
> }
> else if (params["rprmTable"].selected == "Dynamic Locations")
> {
> ExhaustLocationsTable.drop();
> NoRestockLocationsTable.drop();
> }
> else if (params["rprmTable"].selected == "Exhaust Locations" && "No
> Restock Locations")
> {
> DynamicLocationsTable.drop();
> }
> else if (params["rprmTable"].selected == "Exhaust Locations" && "Dynamic
> Locations")
> {
> NoRestockLocationsTable.drop();
> }
> else if (params["rprmTable"].selected == "No Restock Locations" &&
> "Dynamic Locations")
> {
> ExhaustLocationsTable.drop();
> }
>
> Am i on the right track? Any help is apppreciated.
> Note: I already tried .value, doesnt work either.
Re: multiple listbox parameter trouble [message #498015 is a reply to message #497959] Fri, 13 November 2009 17:06 Go to previous message
jlhernan is currently offline jlhernanFriend
Messages: 13
Registered: November 2009
Junior Member
thanks for the reply jason, I figured it out on my own, for anyone who is interested here is my solution, works perfectly!

ExhaustLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "exhaustLocations");
NoRestockLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "noRestockLocations");
DynamicLocationsTable = reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "dynamicLocations");

var size = params["rprmTable"].value.length;

var items = '';

for(var i = 0; i < size; i++)
{
if(params["rprmTable"].value[i] == "Exhaust Locations")
items += '1,';
else if(params["rprmTable"].value[i] == "No Restock Locations")
items += '2,';
else if(params["rprmTable"].value[i] == "Dynamic Locations")
items += '3,';
}

var parts = items.split(",");

if((parts.length - 1) == 1)
{
if(parts[0] == '1')
{
NoRestockLocationsTable.drop();
DynamicLocationsTable.drop();
}
else if(parts[0] == '2')
{
ExhaustLocationsTable.drop();
DynamicLocationsTable.drop();
}
else if(parts[0] == '3')
{
NoRestockLocationsTable.drop();
ExhaustLocationsTable.drop();
}
}
else if((parts.length - 1) == 2)
{
if((parts[0] == '1' || parts[1] == '1') && (parts[0] == '2' || parts[1] == '2'))
DynamicLocationsTable.drop();
else if((parts[0] == '2' || parts[1] == '2') && (parts[0] == '3' || parts[1] == '3'))
ExhaustLocationsTable.drop();
else if((parts[0] == '3' || parts[1] == '3') && (parts[0] == '1' || parts[1] == '1'))
NoRestockLocationsTable.drop();
}
Previous Topic:Dynamically adding barcode - how to extract info from birt?
Next Topic:How to give permissions rights in my BIRT Reports ?
Goto Forum:
  


Current Time: Fri Mar 29 07:15:23 GMT 2024

Powered by FUDForum. Page generated in 0.02205 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top