Database Reference
In-Depth Information
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
To o l b o x
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.
Va l i d a t e t h e e x p r e s s i o n a n d c l i c k
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
To o l b o x
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])
HINT
Drag and drop the
SearchText
and
Product
description data items from the
Data Items
tab of the
Available Components
pane to avoid having to type in the whole
expression. When referencing data item and query item names in IBM Cognos Report
Studio, the names are case-sensitive.