在SSIS中使用“Dynamics CRM Source”中的变量fetchXML

问题描述 投票:0回答:2

我在该软件包中构建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.

任何想法如何让这个工作?

ssis dynamics-crm fetchxml kingswaysoft
2个回答
2
投票

正如Arun在评论中建议的那样,第三个选项(下面复制)应该有效。

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

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


1
投票

我建议您像String一样创建一个SSIS变量作为FetchXML。

您可以在上一步中使用该字符串中的变量创建自己的FetchXML,因此您可以直接在表达式设置中使用fetchxml变量:

我认为您正在使用CozyRoc,因此您可以在组件“动态数据流任务加”中将Fetchxml变量配置到设置配置中:“您的动态数据流任务加”>高级>表达式> [“您的数据名称Flow任务插件“]。[@ [User :: YourVariableFetchXml]

© www.soinside.com 2019 - 2024. All rights reserved.