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
    Posts
    • #9039
      Jon Whisman
      Participant

      Hello,

      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]
      AND
      Defect_x0020_Type = currentItem:Escalation_x0020_Category
      AND
      (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
      Keymaster

      Hi,
      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:

      <Where>
      <And>
      <And>
      <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>
      </And>
      <Geq><FieldRef Name="Defect_x0020_Date" /><Value Type="DateTime"><Today OffsetDays="-365" /></Value></Geq>
      </And>
      </Where>

      Alexander

    • #9100
      Jon Whisman
      Participant

      Alexander,

      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.