Database Reference
In-Depth Information
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.
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.
4.
In the
Properties
window for the
Data Item
, use the
Name
property to rename the
DataItem1
data item to
Position
.
5.
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
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.
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
.
8.
In the
Properties
window for the
Data Item
, use the
Name
property to rename the
DataItem1
data item to
PartOne
.
9.
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
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])
NOTE
The expression has two single quotes without spaces. If the searched text does
not exist in the Product description field, we will just default to an empty string (two single
quotes indicate an empty string).