Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Am appending a filter condition to a particular view

alertview.Query = viewQuery.ToString();
alertview.ParentList.ParentWeb.AllowUnsafeUpdates = true;
alertview.Update();
alertview.ParentList.Update();
alertview.ParentList.ParentWeb.AllowUnsafeUpdates = false;

ViewQuery contains this XML:

<GroupBy Collapse="TRUE" GroupLimit="100">
    <FieldRef Name="AlertGrp" />
</GroupBy>
<OrderBy>
    <FieldRef Name="PriorityNoLink" Ascending="FALSE" />
    <FieldRef Name="match_time" Ascending="FALSE" />
</OrderBy>
<Where>
    <Or>
      <And>
         <Geq>
              <FieldRef Name="Created" />
              <Value Type="DateTime"><Today OffsetDays="-150" /></Value>
         </Geq>
       </And>
       <Neq>
          <FieldRef Name="Category" />
          <Value Type="Text">ACH Alert</Value>
       </Neq>
       <Neq>
           <FieldRef Name="Category" />
           <Value Type="Text">Check Fraud</Value>
       </Neq>
    </Or>
 </Where>

After deploy this code if i go and check the view of the list it is showing <!#Render Failed#> but if i check the modify view am able to see the appended condition Created greater than or equal to [Today]-50.

But after seeing this if i change condition to [Today]-100 and save it is showing perfect records.

Please help me to rectify this bug.

share|improve this question
    
It is hard to help you if can not see your CAML –  Robert Lindgren Jul 26 '13 at 6:05
    
<GroupBy Collapse="TRUE" GroupLimit="100"><FieldRef Name="AlertGrp" /></GroupBy><OrderBy><FieldRef Name="PriorityNoLink" Ascending="FALSE" /><FieldRef Name="match_time" Ascending="FALSE" /></OrderBy><Where><Or><And><Geq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-150" /></Value></Geq></And><Neq><FieldRef Name="Category" /><Value Type="Text">ACH Alert</Value></Neq><Neq><FieldRef Name="Category" /><Value Type="Text">Check Fraud</Value></Neq></Or></Where> –  user18508 Jul 26 '13 at 7:17
    
Seems to me that you have three different Or-statements nested within on single <Or>, you can really just have two without using an extra <Or> for the second two (every <And> and <Or> can only contain two <Geq> or <Neq> etc) –  Robert Lindgren Jul 26 '13 at 7:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.