1

我有一个简单的管道,我从 Azure SQL DB 表中查找日期,然后尝试将其传递给 Dynamics 的 XML 查询。

查找活动成功,输出看起来不错,我收到一条关于 XML 查询的错误消息,我已经尝试解决了很长时间,但到目前为止没有任何成功。

这是我收到的错误消息

这是我在源查询中使用的 XML 查询:

<fetch>
<entity name="account" >
<all-attributes/>
    <filter type="and">
      <condition attribute="modifiedon" operator="on-or-after" value="@{activity('LookupAccountSQL').output.firstRow.modate}" />
    </filter>
  </entity>

查找活动名称为 LookupAccountSQL,SQL 查询简单如下:(也为该活动成功调试运行):

SELECT CAST(MAX(modifiedon)) as modate FROM dbo.account

任何帮助是极大的赞赏!

4

1 回答 1

0

感谢我的问题下方的有用评论,我找到了问题所在。无论我在 SQL 查询中使用强制转换,查找活动都会返回一个日期时间。

解决方案是在 Fetchxml 的顶部放置一个 formatDateTime() 函数。

<fetch>
  <entity name="account" >
   <all-attributes/>
    <filter type="and">
     <condition attribute="modifiedon" operator="on-or-after" value="@{formatDateTime(activity('LookupAccountSQL').output.firstRow.modate,'yyyy-MM-dd')}" />
    </filter>
  </entity>
于 2020-12-04T14:20:07.557 回答