sharepoint-2007filterdataviewwebpart

Filter a Data View Web Part by "last 3 days"


We have a custom list that has a column called "Connection Date" and need to display the most recent list items (relative to this "Connection Date" column) in various places across the portal. the Data View Web Part appears to be the best solution, but I'm having difficulty finding the right method & syntax to filter by date.

I can create a parameter and filter by a value for another column. I can filter by a specific date. I can't seem to figure out how to say "Show me all list items where 'Connection Date' is in the range of [Today] and [Today]-3".

Is this possible? Does anyone know how to do this?

Thanks!


Solution

  • if you use CAML, you can do it.

    <Where>
      <Gt>
          <FieldRef Name="Created" Nullable="True" Type="DateTime"/>
          <Value Type="DateTime"><Today OffsetDays="-7"/></Value>
      </Gt>
    </Where>