Thursday, June 17, 2010

CQWP Expiration Date issue

Scenario
  • You would like to filter your Content Query Web Part by Expiration Date.  You would like items to show up when any of the following are true (OR filter)

    • They are not expired (Expiration is greater than or equal to [Today])
    • Have no expiration date (expiration is null)
Issue
  • There is no Null option in the CQWP Web Part Edit Toolpane, therefore you can only enter the first criteria above.  Therefore, when the Expiration field is left blank (null date), the value is excluded from results.
Resolution
  • One workaround is to use a Data View web part via SharePoint Designer instead of the CQWP.  This will allow you to display a similar format, while adding a null date to the filter.

    • Use the a href="/{@FileDirRef}/DispForm.aspx?ID={@ID}" syntax to include a hyperlink in the title
    • The ... (more) feature will not be included