locked
date comparison on custom site RRS feed

  • Question

  • I took over a SharePoint site that is a true custom site, its using XSL to show the data on .aspx pages. I have one page that I have to show all items where the posted date is not equal to today, meaning that the item has a posted date of 6/1/2011, I shouldn't see it on my output page until 6/1/2011. How can I get this accomplished in the XSL file?
    • Edited by Mike Walsh FIN Friday, May 6, 2011 6:19 PM Need some help removed from Title. Clear as you wouldn't have posted otherwise
    Friday, May 6, 2011 5:33 PM

Answers

  • I'm not sure how your .xsl file is coded but there must be a way (much like th dvwp) that each row is called. So add a filter to it so that it will only display items equal to today like so (I took this directly from a dvwp):

    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
               ddwrt:FormatDateTime(string(@Date), 1033, 'yyyyMMdd') =   
               ddwrt:FormatDateTime(string(ddwrt:Today()) ,1033 ,'yyyyMMdd')
               ]"/>

    Change Date to whatever your column name is ... I hope this helps! Let us know.

    • Proposed as answer by SLF05 Sunday, May 8, 2011 8:42 PM
    • Unproposed as answer by SLF05 Sunday, May 8, 2011 8:42 PM
    • Proposed as answer by Hemendra AgrawalModerator Monday, May 9, 2011 1:17 PM
    • Marked as answer by Mike Walsh FIN Monday, May 9, 2011 5:33 PM
    Friday, May 6, 2011 7:17 PM

All replies

  • Here take a look at this article. I assume, you are using DataView webpart to display the data. http://blogs.msdn.com/b/sharepointdesigner/archive/2008/02/25/filtering-and-formatting-with-date-values.aspx#filter_list_on_today_offset

    You will have to open the page in designer to mention the criteria.


    V
    Friday, May 6, 2011 6:28 PM
  • the page is reading an  .XSL file to show the data ,however, when I go to that .xsl file or even the .aspx page, I can't add any filtering to the dataview, which is what i've done in the past.
    Friday, May 6, 2011 6:32 PM
  • I'm not sure how your .xsl file is coded but there must be a way (much like th dvwp) that each row is called. So add a filter to it so that it will only display items equal to today like so (I took this directly from a dvwp):

    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
               ddwrt:FormatDateTime(string(@Date), 1033, 'yyyyMMdd') =   
               ddwrt:FormatDateTime(string(ddwrt:Today()) ,1033 ,'yyyyMMdd')
               ]"/>

    Change Date to whatever your column name is ... I hope this helps! Let us know.

    • Proposed as answer by SLF05 Sunday, May 8, 2011 8:42 PM
    • Unproposed as answer by SLF05 Sunday, May 8, 2011 8:42 PM
    • Proposed as answer by Hemendra AgrawalModerator Monday, May 9, 2011 1:17 PM
    • Marked as answer by Mike Walsh FIN Monday, May 9, 2011 5:33 PM
    Friday, May 6, 2011 7:17 PM
  • there is something in the XSL named Rows already, can there be two or can I just add what you recommend to the existing one? The existing one looks something like this:

    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@ContentType='Documents' or (@ContentType='Links' and contains(@Category, $Section))]" />

    Friday, May 6, 2011 7:27 PM
  • it appears that it worked, thanks

    Moderator Note: I have deleted your new question. This thread is closed as your original question has been answered. Post new questions in new threads.

    • Edited by Mike Walsh FIN Monday, May 9, 2011 5:33 PM Moderator Note added about not adding questions to threads
    Friday, May 6, 2011 7:56 PM