Hello,
The code I shared that was tested code for Calendar List. Please verify You may be doing anything wrong.
- Yes you need to use SPD CAML editing, because the browser based filter allow 'All' match , and we need 'Either-Or' Filters. So you will have to modify the view CAML using SPD.
- The code I have shared in my previous reply that was for Calendar list/view.I am Sharing the
Tested and verified steps again for Custom List/Tabular View and for Modified Field . Hope This will be helpful.
1- Create a Calculated column in your list. Note that should return Numeric Value for Hours ,
Not "hh:mm:ss" . So the formula should be -
- Name - ModifiedHrs
- Type - Calculated
- Formula: =HOUR(Modified)
- Format -Number (1, 1.0, 100)
Number of decimal places: 0
2- Create a Tabular View ( e.g. DayState.aspx) for your List. (not Calendar View), through browser with filter ( Modified equal to [Today]).
3. Now Open the view page (DayState.aspx) in SharePoint designer code view [Edit in Advance Mode]
4. Locate the CAML query associated with the filter (Modified = [Today]), you can find something like
<WebPartPages:WebPartZone ---
<WebPartPages:XsltListViewWebPart ----
-----
<XmlDefinition>
<View --->
<Query>
<OrderBy>--</OrderBy>
<Where>
<Eq>
<FieldRef Name="Modified"/>
<Value Type="DateTime"><Today/></Value>
</Eq>
</Where>
</Query>
<ViewFields---->
----
</View></XmlDefinition>
</XmlDefinition>
5. Replace the <Where>----</Where> Section with this one
<Where>
<Or><And><Eq><FieldRef Name="Modified"/>
<Value Type="DateTime"><Today OffsetDays="-1"/>
</Value></Eq><Gt><FieldRef Name="ModifiedHrs"/>
<Value Type="Number">14</Value></Gt></And>
<And><Eq><FieldRef Name="Modified"/>
<Value Type="DateTime"><Today/></Value></Eq><Lt>
<FieldRef Name="ModifiedHrs"/>
<Value Type="Number">16</Value></Lt></And></Or>
</Where>
6. Save the page , and test it in browser
7. Note :
- If you have different field names , then Please change the field names with InternalName of fields in your List
- Set the CAML in single line , remove spaces
- This is for Custom List/Tabular View. For Calendar view , the View Definition are in different format, you will have to replace < and > as I explained in my previous post.
- This is tested code , so it should work. In Case of any issue , you can PM/email me or Post here.Thanks