PRJ: Filter with Many Conditions Produces Unexpected Results (132462)
The information in this article applies to:
- Microsoft Project for Windows 95 4.1
- Microsoft Project for Windows 3.0
- Microsoft Project for Windows 3.0a
- Microsoft Project for Windows 4.0
- Microsoft Project for the Macintosh 3.0
- Microsoft Project for the Macintosh 4.0
This article was previously published under Q132462 SUMMARY
When you create a filter with multiple conditions and not all entries in
the And/Or column are the same, you may get unexpected results.
The filter definition dialog box has neither a way of grouping conditions
by priority nor an order of precedence. Instead, conditions are grouped
according to the order in which they appear in the dialog box.
MORE INFORMATION
Filter conditions are evaluated solely on the basis of their sequential
order in the filter dialog box.
Consider the following examples:
Example 1
The following information is evaluated as:
Flag1 Equals Yes And
Flag2 Equals Yes Or
Flag3 Equals Yes Or
Flag4 Equals Yes And
Flag5 Equals Yes
is interpreted as
((Flag1 Equals Yes And Flag2 Equals Yes) Or Flag3 Equals Yes Or Flag4
Equals Yes) And Flag5 Equals Yes
rather than:
(Flag1 Equals Yes And Flag2 Equals Yes) Or Flag3 Equals Yes Or (Flag4
Equals Yes And Flag5 Equals Yes)
Example 2
The following information
Flag1 Equals Yes Or
Flag2 Equals Yes And
Flag3 Equals Yes And
Flag4 Equals Yes Or
Flag5 Equals Yes
is interpreted as
(((Flag1 Equals Yes Or Flag2 Equals Yes) And Flag3 Equals Yes) And
Flag4 Equals Yes) Or Flag5 Equals Yes
and not:
(Flag1 Equals Yes Or Flag2 Equals Yes) And Flag3 Equals Yes And
(Flag4 Equals Yes Or Flag5 Equals Yes)
Using example 2, another way to look at how filter conditions are
evaluated is:
(Flag1 Equals Yes) = Result1
Result1 Or (Flag2 Equals Yes) = Result2
Result2 And (Flag3 Equals Yes) = Result3
Result3 And (Flag4 Equals Yes) = Result4
Result4 Or (Flag5 Equals Yes) = Filter Result
This behavior limits the ways filter conditions can be combined in
Microsoft Project. For example, the second member of each pair of possible
interpretations above cannot be expressed in a project filter.
If different behavior is needed, a macro using Microsoft Project's Visual
Basic for Applications language may be used. Because Visual Basic for
Applications has full support of logical expressions, a macro can be used
to set a flag field to Yes for those tasks that meet the desired
conditions. You can then use a normal Microsoft Project filter that filters
the flag field to display the desired tasks.
Modification Type: | Major | Last Reviewed: | 11/25/2003 |
---|
Keywords: | kbprb kbusage KB132462 |
---|
|