| Filters
You can filter your Outlook data using the Filter= directive,
which should appear as a separate line at the beginning of the CLIPFORM template. The Filter= directive is written in the following
format:
[Filter=OutlookField=Value]
Where OutlookField is any valid Outlook field, and Value
is the value to be filtered. You may use any of the following
logical operators: =, <>, >, <, <=, and >=. The following are
examples of acceptable filters:
[Filter=CreationTime
> 01/01/2001]
[Filter=WebPage
<> '']
[Filter=AllDayEvent
= True]
You can specify
dates relative to today's date. For example, Today-1 filters on
yesterday; Today+1 filters on tomorrow; and Today+10 filters on ten days
from now. Here's an example which uses two filters to filter a
task list to include only tasks that are not yet complete, and are due
within the next 7 days:
[Filter=Complete=False]
[Filter=DueDate<=Today+7]
Note, you can filter on user properties. This is a convenient
way to manage a mailing list which is a subset of a contact
database. For example, to create a mailing list for a newsletter,
you could add an Outlook custom yes/no field titled Newsletter.
Display this custom field in an Outlook folder view, and simply check
this value for the contacts you wish to add to this list. Then use
CLIPFORM to extract only the contact names and addresses on this mailing
list:
[Source=outlook:Contacts]
[Output=c:\docs\newslist.txt]
[Filter=Newsletter=True]
[FullName]
[BusinessAddress]
You can also filter on Outlook fields containing enumerations.
However, you must use the integer value Outlook assigns to each
enumerated field. These integer values are shown below.
|
BusyStatus
0 = Free
1 = Tentative
2 = Busy
3 = Out of Office
FlagStatus
0 = Normal
1 = Complete
2 = Flagged
|
Sensitivity
0 = Normal
1 = Personal
2 = Private
3 = Confidential
Status (for
Tasks)
0 = Not Started
1 = In Progress
2 = Completed
3 = Waiting on someone else
4 = Deferred |
For example, the following filter will include all task items which
are not completed:
[Filter=Status<>2]
Beginning in version 1.2, you can include multiple filter criteria in
the same Filter= directive, linking them with a logical AND
(items are only selected if they meet all criteria) or logical OR (items
are selected if they meet either criterion). Separate filter
criteria with a vertical bar (|) for logical OR. Separate filter
criteria with a caret (^) for logical AND. For example, the
following filter will extract all persons born before 1960 or after 1990
(logical OR):
[Filter=Birthday<1/1/1960|Birthday>=1/1/1990]
The following filter will extract all persons born between 1960 and
1970 (logical AND):
[Filter=Birthday>=1/1/1960^Birthday<1/1/1970]
You can include three or more filters in a single line, and can link
them with both OR and AND. Be aware, however, that filters are
interpreted from left to right. The following filter, for example,
will extract persons born before 1960, and also between 1980 and 1990:
[Filter=Birthday<1/1/60|Birthday>1/1/80^Birthday<1/1/90]
You can also use more than one Filter= directive. Note, if
you use more than one Filter= directive, items are only selected
if they meet ALL filter criteria (logical AND).
Include
A variation of filters is the Include= directive. Unlike
the Filter= directive, the Include= directive will include
any item which meets any of two or more filters on the same field.
For example, the following template will include only individuals who
were born during the 1950's:
[Source=outlook:Contacts]
[Output=c:\docs\output.txt]
[Filter=Birthday>=1/1/1950]
[Filter=Birthday<1/1/1960]
[Sort=Birthday]
[FullName] [Birthday|mmmm
d, yyyy]
This version, however, uses the Include= directive to include
individuals born before 1930 or after 1990:
[Source=outlook:Contacts]
[Output=c:\docs\output.txt]
[Include=Birthday<1/1/1930]
[Include=Birthday>=1/1/1990]
[Sort=Birthday]
[FullName] [Birthday|mmmm
d, yyyy]
Note, if you tried to use the Filter= directive instead of the
Include= directive, no items would be returned, as no items would
have a Birthday that was both on or after 1/1/1990 and before 1/1/1930.
IMPORTANT NOTE: The Include= directive is slower
than the Filter= directive, since it must tag all Outlook items
meeting any of the Include criteria. It should not be used in
conjunction with the Filter= directive, since results can be
unpredictable. Most of the time you will want to use the Filter=
directive in your templates, for its speed and flexibility. However,
the Include= directive leaves each found item tagged with the user
property ClipFormTemp=True. You can therefore create a view
in Outlook filtered to show only items with this value – thus allowing
ClipForm to indirectly let you create a filtered view in Outlook with OR
logic.
Sorting
You can also sort all the extracted items on the basis of most any
Outlook field value, using the Sort= directive. Simply
specify the Outlook field against which you would like to sort.
[Sort=FileAs]
The field may but need not be enclosed in square brackets.
Please note, you cannot sort on the basis of a user-defined field.
To sort items in descending order, follow the field with True
as shown below.
[Sort=Mileage, True]
The following example uses CLIPFORM to create a birthday list, sorted
by age:
[Source=outlook:Contacts]
[Output=c:\docs\birthdays.txt]
[Sort=Birthday]
[Birthday|mm/dd/yy]
- [FullName]
|