简体   繁体   English

根据参数值过滤数据集结果

[英]Filter Dataset Result based on Parameter Value

I am working on Microsoft Dynamics Reporting service.我正在开发 Microsoft Dynamics Reporting 服务。 My requirement is to show records which is dated 3 years or earlier from a given date.我的要求是显示从给定日期起 3 年或更早的记录。 The parameter I have is a date selection field.我的参数是一个日期选择字段。 What I am trying to achieve is get records based on my condition from the date I have selected on the parameter.我想要实现的是从我在参数上选择的日期开始根据我的状况获取记录。

To filter data based on the current date, I can use:要根据当前日期过滤数据,我可以使用:

<condition attribute="modifiedon" operator="olderthan-x-months" value="36" />

But, to get the data filtered based on the parameter value is what I can't figure out.但是,要根据参数值过滤数据是我想不通的。

Can someone help me with this?有人可以帮我弄这个吗?

You should use between operator, but in fetchxml you can achieve it this way.您应该使用 between 运算符,但在 fetchxml 中您可以通过这种方式实现。

<filter type="and">
  <condition attribute="modifiedon" operator="on-or-after" value="2016-10-04" />
  <condition attribute="modifiedon" operator="on-or-before" value="2019-10-03" />
</filter>

Also expression can help you to calculate and pass parameters.表达式还可以帮助您计算和传递参数。

We can add a dynamic date for the report.我们可以为报告添加动态日期。 We can add another date which will have a custom code to have a date 3 years prior to the input date or current date.我们可以添加另一个具有自定义代码的日期,以使日期早于输入日期或当前日期 3 年。 This date can be referenced to the FetchXML query to filter the records.该日期可以引用到 FetchXML 查询以过滤记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM