有可能在fetchxml中设置演员表字段吗? [英] Is that possible to make cast field in fetchxml?

查看:77
本文介绍了有可能在fetchxml中设置演员表字段吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在fetchxml中将字段从标识符转换为字符串?
我有这个查询:

  select * 
从table1 t1左外部联接table2 t2
on t1.stringId = CAST(t2.id as varchar(40))
其中t2.id为null且t1.childid不为null

,然后此行 t1.stringId = CAST(t2.id as varchar(40))
can'可以在字段 stringId为字符串但在值中为GUID
的情况下在fetchxml中进行创建,而我希望具有该相等性。

 <获取版本= 1.0 output-format = xml-platform mapping =逻辑 distinct = true> 
<实体名称= table1>
<属性名称= stringid />
<属性名称= te_name />
< link-entity name = table1从= id到= stringid link-type = outer alias = s />
< filter type = and>
< conditionentityname = s attribute = stringid operator = null />
< / filter>
< / entity>
< / fetch>


解决方案

我不知道我是否缺少某些东西,但是当涉及到连接类型时,Dynamics CRM / 365非常宽容。
很可能将字符串字段连接到guid字段。
请参见以下示例,其中我在联系人的传真属性中放置了一个帐户的向导:

 < ; fetch version ='1.0'output-format ='xml-platform'mapping ='logical'> 
<实体名称=联系人>
< attribute name =全名 />
<属性名称=传真 />
< attribute name = parentcustomerid />
< filter type =’和’>
< condition attribute ='statecode'运算符='eq'value ='0'/>
< / filter>
< attribute name ='contactid'/>
< link-entity name ='account'from ='accountid'to ='fax'link-type ='outer'>
< attribute name =名称 />
< / link-entity>
< / entity>
< / fetch>

是的,您是正确的,无法进行强制转换,但是示例中的查询仍然可以很好地执行,我想这就是全部目标。


Is that possible to make cast field from identifier to string in fetchxml? I have this query:

select *
from table1 t1 left outer join table2 t2
on t1.stringId=CAST( t2.id as varchar(40))
where t2.id is null and t1.childid is not null

and this row t1.stringId=CAST( t2.id as varchar(40)) can't make in fetchxml while field "stringId" is string but it's value is GUID and I want to have that equality.

In fetchxml:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
  <entity name="table1 " >
    <attribute name="stringid" />
    <attribute name="te_name" />
    <link-entity name="table1" from="id" to="stringid" link-type="outer" alias="s" />
    <filter type="and" >
      <condition entityname="s" attribute="stringid" operator="null" />
    </filter>
  </entity>
</fetch>

解决方案

I don't know if I am missing something, but Dynamics CRM/365 is quite forgiving when it comes to joining types. It is quite possible to join a string field to a guid field. See this sample, where I have placed a guid of an account in the fax attribute of a contact:

<fetch version='1.0' output-format='xml-platform' mapping='logical' >
  <entity name='contact' >
    <attribute name='fullname' />
    <attribute name='fax' />
    <attribute name='parentcustomerid' />
    <filter type='and' >
      <condition attribute='statecode' operator='eq' value='0' />
    </filter>
    <attribute name='contactid' />
    <link-entity name='account' from='accountid' to='fax' link-type='outer' >
      <attribute name='name' />
    </link-entity>
  </entity>
</fetch>

So yes, you are correct that casting is not possible, but the query in your example still executes nicely, which I guess was the goal of it all.

这篇关于有可能在fetchxml中设置演员表字段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆