Home > Articles

IBM Cognos 10 Report Studio: Creating Consumer-Friendly Reports

  • Print
  • + Share This
As the report author, should look for ways to present the data in a format that makes the exploration process easier for the consumers. This chapter provides examples of simple reports that present data.
This chapter is from the book

One of the biggest advantages of creating reports in IBM® Cognos® Business Intelligence (BI) is that you can now create one (or more) reports that can be designed to match how business users process information. These consumers do not need to wade through waves of report pages. A series of small reports that independently focus on specific information can link to other reports. We will take a look at using drill-through in the next chapter, but you should look for ways to simplify the reports at every opportunity.

This means you, as the report author, should look for ways to present the data in a format that makes the exploration process easier for the consumers. This chapter provides examples of simple reports that present data.

In our training classes, we regularly hear from students who want to create very complex reports. We begin by asking what the users need to accomplish with the report and begin to build the report using an iterative building block process.

This chapter presents several reports that are designed to leverage features to create reports that focus on a specific task.

Highlight Selected Text

You have been asked by the product marketing staff to create a product catalog. When you ask how it will be used, the market analyst wants to be able to find descriptions of products that use specific phrases to ensure that the proper messages are reaching the customer.

Search technology has become sophisticated enough that documents can be searched for text and the phrases can be highlighted to allow the searcher to focus on the text. The analyst would like to simulate that functionality in the report.

This report should be able to prompt the user for a search phrase and return a list of product descriptions that contain the phrase and highlight the selected text. The final result should look like Figure 1.1.

Figure 1.1

Figure 1.1 Completed enhanced product catalogw

Design

The trick to solving this problem is to utilize several string functions that are available in IBM Cognos Report Studio in order to find the requested part of the text and then cut the preceding and succeeding text. Once the searched text field has been separated into three parts, we can use the logic within our query items to put the strings back together within a single column and highlight only the searched text.

The list report should filter on only those products that contain the search text.

Step-by-Step

The key steps involve the creation of a query that parses the product description and removes any products that do not have the matching phrase. With the query built and tested, the list report is designed.

Step 1: Start the Report

  1. Launch Report Studio and select the GO Data Warehouse (query) package.
  2. Click on the Create new option.
  3. Select the List report template and click OK.

    We will be using the Sales (query) namespace inside the Sales and Marketing (query) folder.

Step 2: Begin the Report Query

The key component of this report is the capability to parse the text of the report description for selected text. This step defines the two fields.

  1. In the Explorer Bar, mouse over the Query Explorer tab and select the Query1 object.
  2. From the Source tab of the Insertable Objects pane, drag the Product description query item from the Products query subject into the Data Items pane of the query design window.
  3. From the Toolbox tab of the Insertable Objects pane, drag a Data Item into the Data Items pane below Product Description.

    The Data Item Expression window opens.

  4. Type the following code in the Expression definition window:
    ?SearchText?

    This creates a parameter called SearchText and assigns the value to the Data Item we just created. We will be searching for the text that will be typed into the server-generated prompt because we will not create a prompt page on our own in this example.

  5. Validate the expression and click OK to close the dialog box.
  6. In the Properties window for the Data Item, use the Name property to rename the DataItem1 data item to SearchText.

Step 3: Include the Search Functionality

In this section, we will add the key functionality to the query. First, we will add a function to search for the matching text. If a match is found, we will break up the description into three fields. If a match is not found, we will leave the description in the first field.

  1. From the Toolbox tab of the Insertable Objects pane, drag another Data Item into the Data Items pane below the SearchText data item.

    The Data Item Expression window opens.

  2. Create the following expression:
    position([SearchText], [Product description])

    The position function returns an integer value that represents where the first character of the searched text begins within the Product description string. If no match is found, the position function returns a zero.

  3. Validate the expression and click OK to close the dialog box.
  4. In the Properties window for the Data Item, use the Name property to rename the DataItem1 data item to Position.
  5. From the Toolbox tab of the Insertable Objects pane, drag another Data Item into the Data Items pane below the Position data item.

    The Data Item Expression window opens.

  6. Create the following expression:
    IF ([Position]=0) THEN
        ([Product description])
    ELSE
        (substring([Product description], 1, [Position]-1))

    If the searched text does not exist in the Product description field, then we will set this first field to the full product description.

    In case the string is found, we want to cut off the text that precedes the string we are looking for, including the space before the string. This is why we use [Position] - 1 as the third argument in the substring function.

  7. Validate the expression and click OK.
  8. In the Properties window for the Data Item, use the Name property to rename the DataItem1 data item to PartOne.
  9. From the Toolbox tab of the Insertable Objects pane, drag another Data Item into the Data Items pane below the PartOne data item.

    The Data Item Expression window opens. This field contains the text to be highlighted only if the text is found.

  10. Create the following expression:
    IF ([Position]=0) THEN
        ('')
    ELSE
        ([SearchText])
  11. Validate the expression and click OK.
  12. In the Properties window for the Data Item, use the Name property to rename the DataItem1 data item to PartTwo.
  13. From the Toolbox tab of the Insertable Objects pane, drag another Data Item into the Data Items pane below the PartTwo data item.

    The Data Item Expression window opens.

  14. Create the following expression:
    IF ([Position]= 0) THEN
           ('')
    ELSE
          (substring ([Product description], [Position] +
          char_length([SearchText]), char_length([Product
          description]) - char_length([SearchText]) -
          char_length([PartOne])))

    If the searched text does not exist in the Product description field, we will just default to an empty string.

    If we do find the text, PartThree needs to contain text that is after the searched string, including the space after the searched string. This is why we need to use character length functions to figure out the positioning of the starting point for the substring function and the length of the remaining string.

  15. Validate the expression and click OK.
  16. In the Properties pane for the Data Item, change the Name property to PartThree.

    This completes our report query build.

  17. Click on the Run menu item and choose the View Tabular Data option to test the Report query before starting the report design. The warning message pop-up can be dismissed by clicking the OK button.

    Sample text for a search that you could use is rope.

    Your results will be similar to Figure 1.2.

    Figure 1.2

    Figure 1.2 Tabular data view

  18. Close the IBM Cognos Viewer window to return to IBM Cognos Report Studio.

Step 4: Create the Report Design

Now we will add the three parts to a list column named Product description.

  1. Mouse over Page Explorer and click on Page1.
  2. From the Data Items tab of the Insertable Objects pane, drag the following data items into the List object: PartOne, PartTwo, and PartThree.
  3. Unlock the List object cells by clicking on the Unlock (currently locked) button on the toolbar.
  4. Click on the PartTwo text item within the PartTwo list column body to select it. Drag it over into the list column body of the PartOne column to the right of the PartOne text item.
  5. Click on the PartThree text item within the PartThree list column body to select it. Drag it over into the list column body of the PartOne column to the right of the PartTwo text item.
  6. Click on the PartTwo text item and then click on the Foreground Color button on the toolbar and select the drop-down arrow. From the Named Colors menu, change the foreground color to Red. Click the Bold button on the toolbar to change the font effect to bold.

    Your design should look similar to Figure 1.3.

    Figure 1.3

    Figure 1.3 Start of the report design

  7. Click on the PartOne text item within the PartOne list column title area.
  8. In the Properties pane, change the Source Type property to Text.
  9. Double-click the Text property and type Product Description.
  10. Click OK to close the dialog box.
  11. Lock the List object cells by clicking on the Lock (currently unlocked) button on the toolbar.
  12. Ctrl-click the PartTwo and PartThree list column bodies and press Delete on the keyboard to remove them from the report design. Your design should now look similar to Figure 1.4.
    Figure 1.4

    Figure 1.4 Key report design

  13. From the Run menu, select Run Report – HTML to view the report.

    When prompted, click in the Provide a value prompt box and type glasses.

    Your results should look similar to Figure 1.5.

    Figure 1.5

    Figure 1.5 Report view

  14. Close the IBM Cognos Viewer window to return to IBM Cognos Report Studio.

Step 5: Finalize the Report Design

The core development of this report is finished; what is left are the finishing touches. We will add additional data elements for the product catalog and filter the report to show only the products whose descriptions contain the keyword that was entered at runtime.

  1. In the Explorer Bar, mouse over the Query Explorer tab and select the Query1 object.
  2. From the Data Items pane, drag the Position data item into the Detail Filters pane.

    The Detail Filter Expression dialog box opens and shows [Position] in the Expression Definition box.

  3. Add the following code in the Expression Definition window after the [Position] expression:
    <> 0

    Your expression should now be this:

    [Position] <> 0.
  4. Click OK to close the Detail Filter Expression dialog box.

    This ensures that only product records with descriptions containing the keyword get retrieved from the database.

  5. Mouse over Page Explorer and click on Page1.
  6. Click on the Report Title text to select it.
  7. Change the Source Type property to Report Expression.
  8. Double-click the Report Expression property.

    The Report Expression dialog box window opens.

  9. Create the following expression in the Expression Definition box:
    'Product Catalog records for keyword - ' +
    ParamDisplayValue('SearchText')
  10. Validate the expression and click OK to close the Report Expression dialog box.
  11. From the Source tab of the Insertable Objects pane, Ctrl-click and drag the Product query item from the Products query subject and the Product Number query item from the Codes folder as columns in front of the Product Description column in the report list.
  12. From the Source tab of the Insertable Objects pane, Ctrl-click and drag the Product color, Product size, Introduction date, and Discontinued date query items from the Products query subject as columns after the Product Description column in the report list.

    Your report design should now look similar to Figure 1.6.

    Figure 1.6

    Figure 1.6 Final report design

  13. From the Run menu, select Run Report – HTML to view the report. When prompted, click in the Provide a value prompt box and type rope.

    Your results should look like Figure 1.7.

    Figure 1.7

    Figure 1.7 Final enhanced product catalog

  14. Close the IBM Cognos Viewer window to return to IBM Cognos Report Studio.

By using a combination of string functions, we were able to split the original text field into three text items that contained all text before the searched string, the actual search string, and all text after the searched string, respectively. Once the query was built, we were able to use a simple IBM Cognos Report Studio built-in feature to unlock the report list cells in order to be able to condense the report and combine all the row data in one defined column.

Our careful string manipulation and simple font-color change allowed us to create an illusion of word highlighting within a larger text field based on the word search entered by the user at runtime.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020