Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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 8 Report Studio Cookbook

You're reading from   IBM Cognos 8 Report Studio Cookbook Over 80 great recipes for taking control of Cognos 8 Report Studio

Arrow left icon
Product type Paperback
Published in Jun 2010
Publisher Packt
ISBN-13 9781849680349
Length 272 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Abhishek Sanghani Abhishek Sanghani
Author Profile Icon Abhishek Sanghani
Abhishek Sanghani
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

IBM Cognos 8 Report Studio Cookbook
Credits
About the Author
About the Reviewers
Preface
1. Report Authoring Basic Concepts FREE CHAPTER 2. Advanced Report Authoring 3. Tips and Tricks: JavaScripts 4. Tips and Tricks: Report Page 5. XML Editing 6. Writing Printable Reports 7. Working with Dimensional Models 8. Macros 9. Using Report Studio Better 10. Some More Useful Recipes 11. 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.

Getting ready

Create a simple list report with Product | Product name and Sales fact | Quantity as columns.

How to do it...

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

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

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

  4. Set the prompt name to ProductLine, and then click Next.

  5. Keep the Createa parameterized filter option checked. For package item, choose Sales (query) | Product | Product line code. Click Next.

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

  7. Under Value to display select Sales (query) | Product | Product line .

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

How it works...

When you drag a prompt object from insertable objects, 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 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 standard practice in data warehousing as it improves the performance of the query and uses the index.

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

In our recipe, we chose Product line as 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 Product Line Code of 2101.

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.

For that, select the Tools | Show Generated SQL/MDX option from the menu.

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 8 Report Studio Cookbook
Published in: Jun 2010
Publisher: Packt
ISBN-13: 9781849680349
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