{"id":959,"date":"2015-12-09T22:58:06","date_gmt":"2015-12-09T22:58:06","guid":{"rendered":"http:\/\/blog.wholetomato.com\/?p=959"},"modified":"2019-05-03T17:28:16","modified_gmt":"2019-05-03T21:28:16","slug":"filter-using-logical-or","status":"publish","type":"post","link":"https:\/\/stage.wholetomato.com\/blog\/filter-using-logical-or\/","title":{"rendered":"Filter using logical &#8220;or&#8221;"},"content":{"rendered":"<p>Many of the dialogs\u00c2\u00a0and drop-downs of Visual Assist allow\u00c2\u00a0efficient\u00c2\u00a0lookups via filtering. For example, filtering within Open File in Solution\u00e2\u20ac\u201da dialog with\u00c2\u00a0all files in a solution\u00e2\u20ac\u201dlets one\u00c2\u00a0find a file quickly\u00c2\u00a0if only portions of a\u00c2\u00a0name are\u00c2\u00a0known.\u00c2\u00a0This means one\u00c2\u00a0can find veryLongFilenameInProjectTomato.cpp if he\u00c2\u00a0knows only &#8220;long&#8221; and &#8220;toma&#8221;.<\/p>\n<p>Filtering takes many shapes. Aside from substrings, one can filter\u00c2\u00a0using simple expressions.\u00c2\u00a0Our\u00c2\u00a0expression syntax isn&#8217;t full regex but it is tailored to the content being searched.<\/p>\n<p>In this blog post, I introduce searching using logical &#8220;or&#8221;.<\/p>\n<p>Filtering using logical &#8220;or&#8221; is often applicable when\u00c2\u00a0searching VA Hashtags, where tags are created on-the-fly and often without standards. For example, developers might annotate code with VA Hashtags of the format\u00c2\u00a0&#8220;todo&#8221; followed by\u00c2\u00a0the name of the teammate who needs to review or fix the code, but names are entered as\u00c2\u00a0first names, last names, or misspelled variants thereof.<\/p>\n<p>For tasks related to developer John Smith, we might find VA Hashtags\u00c2\u00a0in either\u00c2\u00a0of the following forms.<\/p>\n<p><code>\/\/ #todoJohnSmith<br \/>\n\/\/ #todoJSmith<\/code><\/p>\n<p>Filtering for\u00c2\u00a0&#8220;smith&#8221; in the VA Hashtags tool window easily finds both.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?ssl=1\" rel=\"attachment wp-att-967\"><img decoding=\"async\" data-attachment-id=\"967\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/filter-using-logical-or\/logicalorsmithdialog-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?fit=315%2C121&amp;ssl=1\" data-orig-size=\"315,121\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"logicalOrSmithDialog\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?fit=300%2C115&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?fit=315%2C121&amp;ssl=1\" class=\"alignnone size-full wp-image-967\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?resize=315%2C121&#038;ssl=1\" alt=\"logicalOrSmithDialog\" width=\"315\" height=\"121\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?w=315&amp;ssl=1 315w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithdialog1.png?resize=300%2C115&amp;ssl=1 300w\" sizes=\"(max-width: 315px) 100vw, 315px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>But a teammate\u00c2\u00a0might annotate code with only John&#8217;s first name.<\/p>\n<p><code>\/\/ #todoJohn<\/code><code><br \/>\n<\/code><\/p>\n<p>In this case, filtering for &#8220;smith&#8221; won&#8217;t find the new hashtag. We\u00c2\u00a0need to search for &#8220;smith or john&#8221;, and we use a comma in our expression to do that.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?ssl=1\" rel=\"attachment wp-att-970\"><img decoding=\"async\" data-attachment-id=\"970\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/filter-using-logical-or\/logicalorsmithjohndialog\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?fit=315%2C121&amp;ssl=1\" data-orig-size=\"315,121\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"logicalOrSmithJohnDialog\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?fit=300%2C115&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?fit=315%2C121&amp;ssl=1\" class=\"alignnone size-full wp-image-970\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?resize=315%2C121&#038;ssl=1\" alt=\"logicalOrSmithJohnDialog\" width=\"315\" height=\"121\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?w=315&amp;ssl=1 315w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog.png?resize=300%2C115&amp;ssl=1 300w\" sizes=\"(max-width: 315px) 100vw, 315px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Then, our code might also include unrelated\u00c2\u00a0hashtags for John, e.g., a comment directed only at him.<\/p>\n<p><code>\/\/ #John, I fixed this for you.<\/code><code><br \/>\n<\/code><br \/>\nThe\u00c2\u00a0previous filtering for &#8220;smith or john&#8221; will include the unwanted\u00c2\u00a0entry.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?ssl=1\" rel=\"attachment wp-att-975\"><img decoding=\"async\" data-attachment-id=\"975\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/filter-using-logical-or\/logicalorsmithjohndialog2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?fit=315%2C121&amp;ssl=1\" data-orig-size=\"315,121\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"logicalOrSmithJohnDialog2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?fit=300%2C115&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?fit=315%2C121&amp;ssl=1\" class=\"alignnone size-full wp-image-975\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?resize=315%2C121&#038;ssl=1\" alt=\"logicalOrSmithJohnDialog2\" width=\"315\" height=\"121\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?w=315&amp;ssl=1 315w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog21.png?resize=300%2C115&amp;ssl=1 300w\" sizes=\"(max-width: 315px) 100vw, 315px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>To omit the unwanted\u00c2\u00a0entry, we need to search for &#8220;todo and smith&#8221; or &#8220;todo and John&#8221;. We do that with multiple substrings and a\u00c2\u00a0comma.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?ssl=1\" rel=\"attachment wp-att-972\"><img decoding=\"async\" data-attachment-id=\"972\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/filter-using-logical-or\/logicalorsmithjohndialog3\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?fit=315%2C121&amp;ssl=1\" data-orig-size=\"315,121\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"logicalOrSmithJohnDialog3\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?fit=300%2C115&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?fit=315%2C121&amp;ssl=1\" class=\"alignnone size-full wp-image-972\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?resize=315%2C121&#038;ssl=1\" alt=\"logicalOrSmithJohnDialog3\" width=\"315\" height=\"121\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?w=315&amp;ssl=1 315w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2015\/12\/logicalorsmithjohndialog3.png?resize=300%2C115&amp;ssl=1 300w\" sizes=\"(max-width: 315px) 100vw, 315px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>This final expression using\u00c2\u00a0logical &#8220;or&#8221; gives us exactly what\u00c2\u00a0we want.<\/p>\n<p>You can use\u00c2\u00a0expressions\u00c2\u00a0in all\u00c2\u00a0dialogs and drop-downs that support filtering, including the several\u00c2\u00a0that support\u00c2\u00a0logical &#8220;or&#8221;:<\/p>\n<ul>\n<li><a href=\"http:\/\/docs.wholetomato.com\/default.asp?W193\">Open File in Solution<\/a><\/li>\n<li><a href=\"http:\/\/docs.wholetomato.com\/default.asp?W192\">List Methods in File<\/a><\/li>\n<li><a href=\"http:\/\/docs.wholetomato.com\/default.asp?W574\">VA Hashtags<\/a><\/li>\n<\/ul>\n<p>If you want to know more about expressions, study one of the features that\u00c2\u00a0supports logical &#8220;or&#8221;, then experiment in all the dialogs and drop-downs you encounter.<\/p>\n<p>Logical &#8220;or&#8221; requires Visual Assist build 2062 or newer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many of the dialogs\u00c2\u00a0and drop-downs of Visual Assist allow\u00c2\u00a0efficient\u00c2\u00a0lookups via filtering. For example, filtering within Open File in Solution\u00e2\u20ac\u201da dialog with\u00c2\u00a0all files in a solution\u00e2\u20ac\u201dlets one\u00c2\u00a0find a file quickly\u00c2\u00a0if only portions of a\u00c2\u00a0name are\u00c2\u00a0known.\u00c2\u00a0This means&#8230;<\/p>\n","protected":false},"author":28485711,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[672],"tags":[],"class_list":["post-959","post","type-post","status-publish","format-standard","hentry","category-tips-and-tricks"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfhqii-ft","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/28485711"}],"replies":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=959"}],"version-history":[{"count":18,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/959\/revisions"}],"predecessor-version":[{"id":984,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/959\/revisions\/984"}],"wp:attachment":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}