Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
BIRT 2.6 Data Analysis and Reporting

You're reading from  BIRT 2.6 Data Analysis and Reporting

Product type Book
Published in Jul 2010
Publisher Packt
ISBN-13 9781849511667
Pages 360 pages
Edition 1st Edition
Languages
Author (1):
John Ward John Ward
Profile icon John Ward
Toc

Table of Contents (15) Chapters close

BIRT 2.6 Data Analysis and Reporting
Credits
About the Author
About the Reviewers
1. Preface
1. Getting Started 2. Installing BIRT 3. The BIRT Environment and First Report 4. Visual Report Items 5. Working with Data 6. Report Parameters 7. Report Projects and Libraries 8. Charts, Hyperlinks, and Drilldowns 9. Scripting and Event Handling 10. Deployment

Using the MultiSelect parameter in an Event Handler


When we run the previous report, we can select either a single or multiple customers, and it will filter down. Now, the drawback is that we have to maintain two copies of our query—one in the query editor under the dataset editor and the one in the Property Binding expression. We can accomplish the same thing if we use an Event Handler and have to maintain only a single copy.

  1. 1. Repeat steps 1-16 in the previous example.

  2. 2. Open the Script Editor, and using the Outline or the Data Explorer, select setGetCustomerOrders. In the Script Editor, choose the beforeOpen event.

  3. 3. Use the following JavaScript for our Event Handler:

    //get the original query from the edit dialog and append the IN statement
    SQL = this.queryText + " AND CUSTOMERS.CUSTOMERNUMBER in (";
    //iterate over the multi-select parameter, and append the values to our query
    for (x = 0; x < params["rprmGetCustomers"].value.length; x++)
    {
    if (x > 0)
    {
    SQL = SQL + ", ";
    }
    SQL ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime