Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
IBM Cognos 10 Report Studio Cookbook, Second Edition

You're reading from   IBM Cognos 10 Report Studio Cookbook, Second Edition Getting the most out of IBM Cognos Report Studio is a breeze with this recipe-packed cookbook. Cherry-pick the ones you want or go through the tutorial step by step ‚Äì either way you'll end up with some highly impressive reports.

Arrow left icon
Product type Paperback
Published in Aug 2013
Publisher Packt
ISBN-13 9781849688208
Length 364 pages
Edition 2nd Edition
Arrow right icon
Toc

Table of Contents (21) Chapters Close

IBM Cognos 10 Report Studio Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Report Authoring Basic Concepts FREE CHAPTER 2. Advanced Report Authoring 3. Using JavaScript Files – Tips and Tricks 4. The Report Page – Tips and Tricks 5. Working with XML 6. Writing Printable Reports 7. Working with Dimensional Models 8. Working with Macros 9. Using Report Studio Efficiently 10. Working with Active Reports 11. Charts and New Chart Features 12. More Useful Recipes 13. Best Practices Recommendations and References Index

Prompts – display value versus use value


In order to achieve the best performance with our queries, we need to perform filtering on the numerical key columns. However, the display values in the prompts need to be textual and user friendly.

In this recipe, we will create a filter that displays the product line list (textual values) but actually filters on the numerical codes (Product_Line_Code).

Getting ready

Create a simple list report with Products/Product and Sales fact / Quantity as columns.

How to do it...

In this recipe, we will create a prompt and examine the differences between using the display value and the use value.

  1. Open Page Explorer and click on the Prompt Pages folder. Drag a new page from Toolbox under Prompt Pages.

  2. Double-click on the newly created prompt page to open it for editing.

  3. From the toolbox, drag Value Prompt to the prompt page. This will open a wizard.

  4. Set the prompt name to ProductLine and then click on Next as shown in the following screenshot:

  5. Keep the Create a parameterized filter option checked. For Package item, choose Sales (query) / Products / Product line code. Click on Next as shown in the following screenshot:

  6. Keep the Create new query option checked. Give the query name as promptProductLine.

  7. Under Value to display, select Sales (query) / Products / Product line.

  8. Click on the Finish button. Run the report to test it.

How it works...

When you drag a prompt object from Toolbox, Report Studio launches the prompt wizard.

In the first step, you choose the parameter to be connected to the prompt. It might be an existing parameter (defined in the query filter or framework model) or a new one. In this recipe, we chose to create a new one.

Then, you are asked whether you want to create a filter. If there is already a filter defined, you can uncheck this option. In our example, we are choosing this option and creating a filter on Product line code. Please note that we have chosen the numerical key column here. Filtering on a numerical key column is a standard practice in data warehousing as it improves the performance of the query and uses the index.

In the next step, Report Studio asks where you want to create a new query for the prompt. This is the query that will be fired on the database to retrieve prompt values. Here we have the option to choose a different column for the display value.

In our recipe, we chose Product line as the display value. Product line is the textual or descriptive column that is user friendly. It has one-to-one mapping with the Product line code. For example, Camping Equipment has a product line code of 991.

Hence, when we run the report, we see that the prompt is populated by Product line names, which makes sense to the users. Whereas if you examine the actual query fired on the database, you will see that filtering happens on the key column; that is, Product line code.

There's more...

You can also check the generated SQL from Report Studio.

In order to do that, navigate to the Tools | Show Generated SQL/MDX option from the menu as shown in the following screenshot:

It will prompt you to enter a value for the product line code (which is proof that it will be filtering on the code).

Enter any dummy number and examine the query generated for the report. You will see that the Product line code (key column) is being filtered for the value you entered.

So, now you know how the prompt display values and use values work.

If you ever need to capture the prompt value selected by the user in expressions (which you will often need for conditional styling or drill-throughs), you can use the following two functions:

  • ParamDisplayValue (parameter name): This function returns the textual value which represents the display value of the prompt. In our example, it will be the product line that was selected by the user.

  • ParamValue (parameter name): This function returns the numeric value which represents the use value of the prompt. In our example, it will be the Product line code for the product line selected by the user.

You have been reading a chapter from
IBM Cognos 10 Report Studio Cookbook, Second Edition - Second Edition
Published in: Aug 2013
Publisher: Packt
ISBN-13: 9781849688208
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 $19.99/month. Cancel anytime