首页 > 解决方案 > 在 SSIS 中使用“Dynamics CRM Source”fetchXML 中的变量

问题描述

我正在该包中构建 SSIS 包我正在使用“Dynamics CRM Source”控件,该控件使用 fetchXML 从 MS Dynamics CRM 检索数据。

这是我的 fetchXML:

<fetch> 
  <entity name='f1_workorder'> 
     <all-attributes /> 
     <filter type='and'> 
        <condition attribute='createdon' operator="on-or-after" value="5/5/2018" /> 
     </filter> 
  </entity> 
</fetch>

您可以看到条件值是硬编码的“5/5/2018”

它假设是从一个名为 XMLPeriod 的变量中读取的。

我尝试了很多方法来使用 fetchXML 中的变量,但没有成功。我试过这个

<condition attribute='createdon' operator="on-or-after" value=@XMLPeriod /> 

和这个

<condition attribute='createdon' operator="on-or-after" value="@XMLPeriod" /> 

和这个

<condition attribute='createdon' operator="on-or-after" value="@[User::XMLPeriod]" /> 

和这个

<condition attribute='createdon' operator="on-or-after" value=@[User::XMLPeriod] /> 

我收到这个错误

'@' is an unexpected token. The expected token is '"' or '''. Line 5, position 71.

知道如何让它工作吗?

标签: ssisdynamics-crmfetchxmlkingswaysoft

解决方案


正如 Arun 在评论中所建议的那样,第三个选项(复制如下)应该可以工作。

<condition attribute='createdon' operator="on-or-after" value="@[User::XMLPeriod]" />

如果它不起作用,请在此处发布整个错误消息,以便我进一步查看。


推荐阅读