We can filter today records using new FetchXML operator Today:
<filter type="and">
<condition attribute="modifiedon" operator="today" />
<condition attribute="modifiedon" operator="yesterday" />
</filter>
We can filter today date using report's built-in field execution time:
=Format(Globals!ExecutionTime,"yyyy-MM-dd")
The Execution Time is formatted as yyyy-MM-dd to be compatible with the query.
Now we can add a parameter field, named "TodayFetchXML", and set it's default value to the expression above and use it to parameterize our FetchXML like this:
<filter type="and">
<condition attribute="scheduledstart" operator="on" value=@TodayFetchXML />
</filter>
We can filter on other dates by adding/subtracting days:
// Parameter function for @YesterdayFetchXML
=Format(DateAdd("d",-1,Globals!ExecutionTime),"yyyy-MM-dd")
// Parameter function for @TomorrowFetchXML
=Format(DateAdd("d",1,Globals!ExecutionTime),"yyyy-MM-dd")
Combining with new FetchXML date operators: on-or-before and on-or-after, we can create more flexible query
<filter type="and">
<condition attribute="scheduledstart" operator="on-or-after" value="@TomorrowFetchXML" />
</filter>
No comments:
Post a Comment