none
content query web part formula

    Question

  • I have a content query web part that is aggregating calendar events.

    It is getting all events where the date is greater than today.

    I want to also add where the date <= one month from now, so it will show from today to one month from today.

    Is there a way to add a formula to this?  meaning something like dateadd(today, +1) or whatever the syntax is?  I am doing this in the sharepoint interface, and only seem to have an option for today or a hard coded date.
    nonam
    Wednesday, March 04, 2009 9:30 PM

Answers

  •  

    Hi

     

    I find an article which may help you:

    How to: Customize the Content Query Web Part by using Custom Properties 

    http://sharepoint.blog.hexun.com/7356729_d.html

    After exporting, you can try to edit the parameter here:

    <property name=”FilterValue1” type =”string” > [Today] +30 <Property>

     

    The original value is “today”, so you can add 30 days to make it show the events which will happen in the future 30 days.

     

    Hope this can help

     

    Lu Zou

     

    • Marked as answer by Lu Zou-MSFT Friday, March 20, 2009 4:03 AM
    Tuesday, March 10, 2009 8:27 AM

All replies

  • I'm pretty sure you can do something like this:
    - Add CQWP to a page and do as much config via the web screen as possible.
    - Export it.
    - Edit the resulting XML by finding the query section and putting in the extra param.
    - Go back and add the web part to a page by importing it.

    I've seen this blogged about here and there but I'm not sure where.

    HTH,

    --Paul Galvin of EMC Consulting, New York area Microsoft MVP - SharePoint Blogging @ http://feeds.feedburner.com/PaulGalvinsSharepointSpace Twitter @ http://www.twitter.com/pagalvin
    Monday, March 09, 2009 12:58 AM
  • Thanks, I exported it, but I am not sure what to do next.  I think that I would be able to add a date in the xml no problem, but I am not sure about adding a formula, or where to put it. 

    meaning
    <sometag>date <= today + 1 month</sometag>

    not
    <sometag>4/9/09</sometag>  //This would work for today, but after today, I would have to reenter.


    Also, the 5th line in the xml is:
    <sometag>date <= today + 1 month</sometag>


    nonam
    Monday, March 09, 2009 3:20 PM
  •  

    Hi

     

    I find an article which may help you:

    How to: Customize the Content Query Web Part by using Custom Properties 

    http://sharepoint.blog.hexun.com/7356729_d.html

    After exporting, you can try to edit the parameter here:

    <property name=”FilterValue1” type =”string” > [Today] +30 <Property>

     

    The original value is “today”, so you can add 30 days to make it show the events which will happen in the future 30 days.

     

    Hope this can help

     

    Lu Zou

     

    • Marked as answer by Lu Zou-MSFT Friday, March 20, 2009 4:03 AM
    Tuesday, March 10, 2009 8:27 AM