Question

I am working on a project in SharePoint 2013.

Currently I am trying to implement list view filtering using OOTB QueryString parameters. I have found the following params have been working a treat when dealing with a single condition: FilterField1, FilterValue1, FilterOp1 etc

http://spsite/Lists/CustomList/Forms/AllItems.aspx?FilterField1=FieldName&FilterValue1=FieldValue&FilterOp1=Gt

The hurdle I have hit is implementing a date range filter i.e. multiple conditions on a single field. Articles I have read have said to use the following to get a date range working:

FilterField1=DateField&FilterValue1=2015-06-01&FilterOp1=Geq&FilterField2=DateField&FilterValue2=2015-06-30&FilterOp2=Leq

When I have applied this to my list URL it only honours the last condition i.e. Date is Less than or equal to 2015-06-30.

I swapped the order of the query string params and again honoured the last condition (this time it was greater than or equal to 2015-06-01).

Any suggestions on how I could get this working using the FilterField query string params?

Was it helpful?

Solution

I read recently that only a single condition is allowed per column so you need to add a calculated column which is just a copy of the date column and use the new column for the other end of your date range in the filter.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top