need help on CAML query – how to filter on a [today] – days

Forums vLooup for SharePoint need help on CAML query – how to filter on a [today] – days

Viewing 2 reply threads
  • Author
    • #9039
      Jon Whisman


      At the moment, we are successfully using vLookup with the 2 filters, but would like to have 3 filters, so we know we need a CAML query to override the default filtering.

      Here is what we are after for our filters:

      Where Associate_x0020_Name = [currentItem:Associate_x0020_Name]
      Defect_x0020_Type = currentItem:Escalation_x0020_Category
      (now this is the part we need help on)
      Defect_x0020_Date = within the last 12 months ([today] – 360 days?)

      How do we do this in CAML? I’m not sure how to format the date column in the CAML query or if it needs to be [today] or now(), etc…

    • #9073
      Alexander Bautz

      The CAML depends on the type of the fields “Associate_x0020_Name” and “Defect_x0020_Type” are, but basically your CAML should look like this:

      <Eq><FieldRef Name="Associate_x0020_Name" /><Value Type="Text">[currentItem:Associate_x0020_Name]</Value></Eq>
      <Eq><FieldRef Name="Defect_x0020_Type" /><Value Type="Text">[currentItem:Escalation_x0020_Category]</Value></Eq>
      <Geq><FieldRef Name="Defect_x0020_Date" /><Value Type="DateTime"><Today OffsetDays="-365" /></Value></Geq>


    • #9100
      Jon Whisman


      Thank you for this, it worked great! It was the Today OffsetDays= that was eluding us. The other fields in the query are just single line of text, so pasting in what you gave was all that was needed. Wish it was all that easy. 🙂 Thank you!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.