none
Customized SharePoint List Filtering Condition

    Frage

  • Hi,

    I would like to set a filtering condition within the fixed variable date under SharePoint TeamSite List view. How could I achieve it?

    As far as the condition is allowed like [Today] or [Me], my request is to filter those filtered list from 6AM to 5PM GMT+8 everyday according to the creation date.

    what's the expression to get the result.

    Dienstag, 19. Juni 2012 17:09

Antworten

  • Hi lincky,

    Based on your description, you cannot achieve this through out-of-the-box in filter, as parvez  said, we can use custom data view web part through SharePoint Designer. When you insert a data view, right click the view, click filter to edit the filter formula.

    Here is expression of filter based on Created column(to check whether time is between 6am and 5pm, we use 24hour format to compare):

    [number(substring((ddwrt:FormatDateTime(string(@Created),1033,'H:mm')),1,3))>=6 and

    number(substring((ddwrt:FormatDateTime(string(@Created),1033,'H:mm')),1,3))<=17]

    Please check it , if there is any problem, please feel free to let me know.

    Best Regards.


    Qiao Wei

    TechNet Community Support

    Mittwoch, 20. Juni 2012 03:18

Alle Antworten

  • By default, SharePoint filters only by Date. You'll need SharePoint designer and either edit that existing view or create a DVWP of that list with appropriate filter. Whichever option you choose, you'll need to add the following "attribute" to the CAML query for the DateTime field being filtered.

    IncludeTimeValue=True

    This will allow you to get the filter to include, well... time. As for the GMT+8, I *think* that'll depend on whatever is the regional setting of the site is, that's what will be used in the all DateTime stamp for the records.

    I had done this before, but don't remember exactly what value of the condition looks like. If you play around it, you might be able to figure it out. Shouldn't be too difficult.

    Hope that helps...


    Pman
    http://www.pmansLab.com/

    Mittwoch, 20. Juni 2012 02:09
  • Hi lincky,

    Based on your description, you cannot achieve this through out-of-the-box in filter, as parvez  said, we can use custom data view web part through SharePoint Designer. When you insert a data view, right click the view, click filter to edit the filter formula.

    Here is expression of filter based on Created column(to check whether time is between 6am and 5pm, we use 24hour format to compare):

    [number(substring((ddwrt:FormatDateTime(string(@Created),1033,'H:mm')),1,3))>=6 and

    number(substring((ddwrt:FormatDateTime(string(@Created),1033,'H:mm')),1,3))<=17]

    Please check it , if there is any problem, please feel free to let me know.

    Best Regards.


    Qiao Wei

    TechNet Community Support

    Mittwoch, 20. Juni 2012 03:18
  • thanks so much~ appreciated
    Samstag, 21. September 2013 13:44
  • Thanks so much as well, :)
    Samstag, 21. September 2013 13:45