Dynamics crm 在fetchxml中可以创建强制转换字段吗?
在fetchxml中是否可以将字段从标识符转换为字符串? 我有一个疑问:Dynamics crm 在fetchxml中可以创建强制转换字段吗?,dynamics-crm,fetchxml,Dynamics Crm,Fetchxml,在fetchxml中是否可以将字段从标识符转换为字符串? 我有一个疑问: 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 这一行t1.stringId=CAST(t2.id为varchar(40)) 字段“stringId”为字符串但其值为GUID时,无法在fetc
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
这一行t1.stringId=CAST(t2.id为varchar(40))
字段“stringId”为字符串但其值为GUID时,无法在fetchxml中生成
我想要平等
在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>
在fetchxml中无法强制转换。(我无法立即对此进行测试。) 链接实体连接键guid(主键和外键)上的两个实体,最好创建关系来维护数据库设计和查询它们 有趣的是,在模式中将Id称为字符串:
<!--
link-entity element - used for joining one entity to its "parent"
-->
<!-- [XDR-XSD] "link-entity" element -->
<xs:complexType name="FetchLinkEntityType">
<xs:choice minOccurs="0"
maxOccurs="unbounded">
<!-- -->
<xs:element ref="all-attributes"
minOccurs="0" />
<xs:element name="attribute"
type="FetchAttributeType"
minOccurs="0"
maxOccurs="unbounded" />
<xs:element name="order"
type="FetchOrderType"
minOccurs="0"
maxOccurs="1" />
<xs:element ref="filter"
minOccurs="0" />
<xs:element name="link-entity"
type="FetchLinkEntityType" />
</xs:choice>
<!-- -->
<xs:attribute name="name"
use="required"
type="xs:string"></xs:attribute>
<xs:attribute name="to"
type="xs:string"></xs:attribute>
<xs:attribute name="from"
type="xs:string"></xs:attribute>
<xs:attribute name="alias"
type="xs:string"></xs:attribute>
<xs:attribute name="link-type"
type="xs:string"></xs:attribute>
<xs:attribute name="visible"
type="xs:boolean"></xs:attribute>
<xs:attribute name="intersect"
type="xs:boolean"></xs:attribute>
</xs:complexType>
更新:
在本机上,fetchxml使用guid键进行连接(例如,从高级查找)。但似乎我们可以用任何字段覆盖
从
到。从今天起,它就开始工作了,以后可能没有文档记录,不受支持。我不知道我是否遗漏了什么,但是Dynamics CRM/365在加入类型时非常宽容。
很有可能将字符串字段连接到guid字段。
请参阅此示例,其中我已将帐户的guid放置在联系人的传真属性中:
<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>
因此,是的,您认为强制转换是不可能的,这是正确的,但是您的示例中的查询仍然执行得很好,我想这就是它的目标。有任何方法可以获得该关系@ʚɞayaalamʚɞCreate 1:N relationship或Lookup属性来完成该操作,但昨天它给出了通用的sql错误有趣的…:-/一般SQL错误可能是由于字符串字段中的guid无效。当使用非guid进行测试时,我得到了相同的结果。如果您同意我的答案是正确的,请随意投票。令人惊讶的是,正如Jonas所说,我将一些记录guid复制到另一个实体的文本框中,并在xrmtoolbox中测试了join查询。:)