|
#1
|
|||
|
|||
Using AND and OR
I want to build a search that says give me all items where (FollowUp = yes and there is no DueDate) OR (FollowUp = Yes and Due date is less than or equal to TODAY). Can this be done? I don't see how to construct it without parenthesis.
Thanks |
#2
|
|||
|
|||
Yes this can be done, basically indenting in the Search Criteria Grid (in the Advanced Search interface) provides the equivalent of parantheses.
All rows at the same indent level have the same precedence (are grouped together). So to group certain criteria together, simply indent them to the same indent level. You can indent with the arrow keys in the Item Toolbar or the Move Up/Down/Left/Right entries in the Item menu... |
#3
|
|||
|
|||
Got it working but it's not obvious to me. How would you read this with parens?
------FollowUp=yes AND Parent Title <> TEMPLATES ------OR DueDate="" ------OR DueDate>=TODAY What confuses me is that first OR. I switched it to an AND and got the same results. The first AND/OR of an indent is irrelevant? |
#4
|
|||
|
|||
If I correctly understand the 1st, 3rd and 4th rows to be indented one level, the following should be the boolean logic employed:
ParentTitle <> TEMPLATES AND (FollowUp=yes or DueDate="" or DueDate>=TODAY) |
#5
|
|||
|
|||
I did not do a good job posting that. 1st and 2nd line are not indented and line 3,4 are indented 1 to the right. I need to show AND but those two first lines are not indented.
Here it is again: --------FollowUp=yes AND --Parent Title <> TEMPLATES ---------------OR DueDate="" ---------------OR DueDate>=TODAY |
#6
|
|||
|
|||
In that case, the logic used by the search would be:
(FollowUp=yes AND ParentTitle <> TEMPLATES) OR (DueDate="" OR DueDate >= TODAY) which is the logical equivalent of: (FollowUp=yes AND ParentTitle <> TEMPLATES) OR DueDate="" OR DueDate >= TODAY You initially said you wanted to achieve this: "... where (FollowUp = yes and there is no DueDate) OR (FollowUp = Yes and Due date is less than or equal to TODAY)". To obtain this logic you should construct your search like this: FollowUp=yes AND DueDate ="" OR <indent 1> FollowUp=Yes AND <indent 1>DueDate <= TODAY or the similar (but equivalent) FollowUp=yes AND <indent 1> DueDate NOT EXISTS OR <indent 1> DueDate = "" OR <indent 1> DueDate <= TODAY The AND or OR for the first row at a new indent level determines how the expression represented by that indent level is evaluated related to the other indent levels... Hope that helps. [We'll work on the help file to try to make this clearer for future users!] Note: The last suggestion also handles the situation where a Followup attribute is assigned (to an Info Item), but no DueDate attribute is even assigned (not sure if this is necessary for your data or not). |
#7
|
|||
|
|||
Thanks Kevina,
1. Two things, The first OR/AND after the indent I don't think works as you stated. I think it is always an AND even if you set it as an OR. I did some tests and changed it to and OR and that should have given me many more results but it gave me the same results as an AND. 2. Most people are going to be confused by this indenting scheme to set up logic. I think if you insert parenthesis into the builder as you indent it might make is easier or just use the space below the tree to show a classic logic expression of what the tree will end up doing. I did not even look in the help because it never occurred to me that indentation might be possible. |
#8
|
|||
|
|||
You are correct that an OR relationship of the first criteria row of an indent level is not honored as I explained.
This is a bug and will be addressed in the upcoming minor release. Thanks for reporting it. |
#10
|
|||
|
|||
Thanks!!
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|