【问题标题】:How is the fetchXML Date Operator resolved by the system系统如何解析fetchXML日期运算符
【发布时间】:2014-04-23 14:36:35
【问题描述】:

CRM 2013-OnPremise

你好,

我已经为这个 fetchXML 定义的未来 7 天内开始日期的项目编写了一个基本视图:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
  <entity name="xxxx_project" >
    <attribute name="xxxx_startdate" />
    <attribute name="xxxx_accountid" />
    <attribute name="xxxx_produom" />
    <order attribute="xxxx_name" descending="false" />
    <filter type="and" >
        <filter type="and" >
            <condition attribute="statecode" operator="eq" value="0" />
            <condition attribute="xxxx_projectstatus" operator="eq" value="331420009" />
            <condition attribute="xxxx_materialsshipdate" operator="null" />
            <condition attribute="xxxx_startdate" operator="next-x-days" value="7" />
        </filter>
    </filter>
    <attribute name="xxxx_projectid" />
  </entity>
</fetch>

现在我期待 fetchXML 将系统日期注入其中,或者至少是一个占位符,例如:

<condition value='2012-03-08T15:10:00Z' />

也许这个值是在运行时添加的,而不是 fetchTemplate 的一部分?那么 Msoft 是否对类似的东西进行了一些运行时更改?

<condition attribute="xxxx_startdate" operator="next-7-days" value="2014-04-23" />

这篇文章说是注入http://social.microsoft.com/Forums/en-US/c5083689-65fb-474f-a7bc-2eff393016fe/datetime-on-or-after-of-fetchxml-questions?forum=crmdevelopment

但我不知道它应该是什么样子。

我问的原因是我想使用这个基本的 fetchXML 作为模板,但注入我选择的日期。

有什么想法吗?

【问题讨论】:

    标签: dynamics-crm-2011 dynamics-crm


    【解决方案1】:

    如果您想根据您的日期动态构建模拟下一个 7 天条件的 fetchXML,您始终可以使用 On 或 Before 和 On 或 After 条件重写它。 例如

    <condition attribute="xxxx_startdate" operator="on-or-after" value="2014-04-23" />
    <condition attribute="xxxx_startdate" operator="on-or-before" value=2014-04-30" />
    

    【讨论】:

    • 啊啊啊好吧。那么你知道这是否是 Msoft 与 Next X days 运营商在幕后所做的事情吗?
    • 在运行时将 fetchxml 转换为查询数据库(在 SQL 中有不同的方法可以实现)
    • OK 当然....但是如果它被转换为 T-SQL 为什么不只允许 T-SQL 或者至少有一个 fetch Equiv。对于大多数 T-SQL 操作?我知道这是一个可能需要水晶球才能回答的问题。---您的原始答案我刚刚完成并完美生成了视图,太棒了!
    猜你喜欢
    • 2011-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-18
    • 1970-01-01
    • 2023-03-23
    相关资源
    最近更新 更多