sql – 如何加入dbo.LocalizedLabelView以获取Dynamics CRM中的
发布时间:2020-12-12 06:42:56 所属栏目:MsSql教程 来源:网络整理
导读:在Dynamics CRM中,我经常从业务用户那里获得创建报告的要求.业务用户了解并谈论实体显示名称和属性标签.要编写查询,我需要将它们映射到实体名称和属性名称.我想用一个查询来查看. 我将如何加入dbo.LocalizedLabelView视图以获取以下查询中的AttributeLabel列
|
在Dynamics CRM中,我经常从业务用户那里获得创建报告的要求.业务用户了解并谈论实体显示名称和属性标签.要编写查询,我需要将它们映射到实体名称和属性名称.我想用一个查询来查看.
我将如何加入dbo.LocalizedLabelView视图以获取以下查询中的AttributeLabel列?我无法弄清楚ObjectId应该引用什么. (如果你能告诉我你是如何找到答案我会特别感激的!) select
[EntityName] = entityNames.Name,[EntityDisplayName] = entityDisplayNames.Label,[AttributeName] = attributeNames.PhysicalName,[AttributeDisplayName] = attributeDisplayNames.Label
--[AttributeLabel] = attributeLabels.Label
from
dbo.EntityView entityNames
inner join dbo.LocalizedLabelView entityDisplayNames
on entityDisplayNames.ObjectId = entityNames.EntityId
and entityDisplayNames.ObjectColumnName = 'LocalizedName'
left outer join dbo.AttributeView attributeNames
on attributeNames.EntityID = entityNames.EntityID
inner join dbo.LocalizedLabelView attributeDisplayNames
on attributeDisplayNames.ObjectId = attributeNames.AttributeID
and attributeDisplayNames.ObjectColumnName = 'DisplayName'
and attributeDisplayNames.LanguageID = entityDisplayNames.LanguageID
--inner join dbo.LocalizedLabelView attributeLabels
-- on attributeLabels.ObjectId = ?????
-- and attributeLabels.LanguageID = entityDisplayNames.LanguageID
where
entityDisplayNames.LanguageID = 1033
order by
entityDisplayNames.Label,attributeDisplayNames.Label
解决方法ObjectId是对CRM数据库中事物的内部ID的引用.这个东西可以是属性,实体,标签等等.由于您需要属性的标签,因此请在此处使用该属性的id作为ObjectId.我想你希望你的连接条件看起来像这样: inner join dbo.LocalizedLabelView attributeLabels
on attributeLabels.ObjectId = attributeNames.AttributeID
and attributeLabels.LanguageID = entityDisplayNames.LanguageID
and attributeLabels.ObjectColumnName = 'DisplayName'
如果需要属性的描述,可以将ObjectColumnName更改为“Description”. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
