微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

sql – 如何加入dbo.LocalizedLabelView以获取Dynamics CRM中的表单标签?

在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”.

原文地址:https://www.jb51.cc/mssql/78140.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐