【问题标题】:How to join dbo.LocalizedLabelView to get form labels in Dynamics CRM?如何加入 dbo.LocalizedLabelView 获取 Dynamics CRM 中的表单标签?
【发布时间】:2011-07-05 23:06:42
【问题描述】:

在 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

【问题讨论】:

    标签: sql label dynamics-crm reporting


    【解决方案1】:

    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 更改为“描述”。

    【讨论】:

      猜你喜欢
      • 2019-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-06
      相关资源
      最近更新 更多