Highlighted Content Web Part (HCWP) filter logic

%3CLINGO-SUB%20id%3D%22lingo-sub-834541%22%20slang%3D%22en-US%22%3EHighlighted%20Content%20Web%20Part%20(HCWP)%20filter%20logic%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-834541%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20I%20understand%20it%2C%20if%20you%20use%20multiple%20filter%20conditions%20in%20a%20HCWP%2C%20the%20conditions%20are%20evaluated%20as%20OR's%20when%20filtering%20on%20the%20same%20parameter%20(e.g.%2C%20Title%20%3D%20ABC%20%3CSTRONG%3EOR%3C%2FSTRONG%3ETitle%20%3D%20XYZ)%2C%20and%20the%20filter%20conditions%20are%20evaluated%20as%20AND's%20when%20filtering%20on%20different%20parameters%20(e.g.%2C%20Title%20%3D%20ABC%20%3CSTRONG%3EAND%3C%2FSTRONG%3ECreated%20by%20%3D%20Current%20User).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20appears%2C%20based%20on%20my%20limited%20testing%2C%20that%20this%20filtering%20logic%20also%20applies%20when%20filtering%20on%20multiple%20managed%20properties.%26nbsp%3B%20In%20this%20instance%20I%20want%20to%20filter%20on%20RefinableDate00%20and%20RefinableString00.%26nbsp%3B%20Since%20these%20are%20different%20managed%20properties%2C%20I%20was%20hoping%20they%20would%20be%20evaluated%20using%20AND%20logic%20(Date%20is%20after%20%5BToday%5D%20%3CSTRONG%3EAND%3C%2FSTRONG%3EString%20%3D%20ABC)%3B%20however%2C%20it%20appears%20that%20the%20conditions%20are%20instead%20being%20evaluated%20as%20OR's%20(Date%20is%20after%20%5BToday%5D%20%3CSTRONG%3EOR%3C%2FSTRONG%3EString%20%3D%20ABC).%26nbsp%3B%20I%20think%20Microsoft%20should%20upgrade%20the%20HCWP%20to%20allow%20users%20to%20specify%20how%20multiple%20filters%20should%20be%20evaluated.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-834541%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EEvaluating%20multiple%20filters%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHighlighted%20content%20web%20part%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharPoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-835786%22%20slang%3D%22en-US%22%3ERe%3A%20Highlighted%20Content%20Web%20Part%20(HCWP)%20filter%20logic%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-835786%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F330577%22%20target%3D%22_blank%22%3E%40Gary_Stewart%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20description%20of%20the%20HCWP%20filter%20is%20correct%20and%20is%20further%20explained%20in%20this%20Microsoft%20doc%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2Fuse-the-highlighted-content-web-part-e34199b0-ff1a-47fb-8f4d-dbcaed329efd%23bkmk_filterandsort%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2Fuse-the-highlighted-content-web-part-e34199b0-ff1a-47fb-8f4d-dbcaed329efd%23bkmk_filterandsort%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20should%20be%20able%20to%20achieve%20your%20desired%20filter%20using%20a%20custom%20query%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fgeneral-development%2Fkeyword-query-language-kql-syntax-reference%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EKQL%3C%2FA%3E%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fschema%2Fquery-schema%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECAML%3C%2FA%3E).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20this%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENorm%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

As I understand it, if you use multiple filter conditions in a HCWP, the conditions are evaluated as OR's when filtering on the same parameter (e.g., Title = ABC OR Title = XYZ), and the filter conditions are evaluated as AND's when filtering on different parameters (e.g., Title = ABC AND Created by = Current User).

 

It appears, based on my limited testing, that this filtering logic also applies when filtering on multiple managed properties.  In this instance I want to filter on RefinableDate00 and RefinableString00.  Since these are different managed properties, I was hoping they would be evaluated using AND logic (Date is after [Today] AND String = ABC); however, it appears that the conditions are instead being evaluated as OR's (Date is after [Today] OR String = ABC).  I think Microsoft should upgrade the HCWP to allow users to specify how multiple filters should be evaluated.  

1 Reply

Hi @Gary_Stewart,

 

Your description of the HCWP filter is correct and is further explained in this Microsoft doc: https://support.office.com/en-us/article/use-the-highlighted-content-web-part-e34199b0-ff1a-47fb-8f4....

 

You should be able to achieve your desired filter using a custom query (KQL, CAML).

 

I hope this helps.

 

Norm