Warm tip: This article is reproduced from serverfault.com, please click

lookup-带有参数错误的Azure Source Dynamics

(lookup - Azure source Dynamics with parameter error)

发布于 2020-11-27 10:26:59

我有一个简单的管道,可以在其中从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

任何帮助是极大的赞赏!

Questioner
Matyas
Viewed
11
Matyas 2020-12-04 22:20:07

多亏了我的问题下面的有用评论,我才发现了问题所在。无论我在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>