简体   繁体   English

如何使用颜色或标签格式化.rdl报告结果

[英]How to Format a .rdl Report result with colours or tags

I am new to CRM and SQLServer Reporting and I am trying to create a report that displays all notes from different entities. 我是CRM和SQLServer Reporting的新手,我试图创建一个显示来自不同实体的所有注释的报告。 For those who are not familiar with CRM below is the description for the report: I have entity A (FilteredAnnotation - keeps records of notes of different entities), which has a field called notetext that stores text (note) and objectid which stores a GUID related to a particular entity. 对于那些不熟悉CRM的人,下面是该报告的描述:我有一个实体A(FilteredAnnotation-保留不同实体的注释的记录),它具有一个称为notetext的字段,用于存储文本(note)和一个objectid,用于存储GUID与特定实体有关。 For instance, the GUID stored in this field can be related to lets say Entity B (Filterednew_candidate) or Entity C (FilteredNew_attainmentmilestone), or other entities as in CRM every entity has relationship to Annotation's entity. 例如,存储在此字段中的GUID可以与实体B(Filterednew_candidate)或实体C(FilteredNew_attainmentmilestone)或其他实体相关,例如CRM中的每个实体都与注释的实体相关。

In my case, the person running the report will input a reference number to entity B (candidate). 在我的情况下,运行报告的人将为实体B输入一个参考号(候选人)。 The entity candidate has relationship with entity C (attainmentmilestone), so basically I want the report to display all notes (retrieved from entity A - annotation) that are linked to a particular candidate. 实体候选人与实体C有关系(成就里程碑),因此基本上我希望报告显示与特定候选人链接的所有注释(从实体A-注释中检索)。

At the moment I have my query running good and displaying all results but the problem is that there is nothing to separate or specify from where exactly the notes come from. 目前,我的查询运行良好并显示了所有结果,但问题是没有什么可与笔记的确切来源分开或指定的。 Basically, I want to be able to show or differ notes of Entity B and C. I can think of idea: a) Be able to write their entity Name on top of each record, so it would be something like: Candidate: result Stream: result PROBLEM: I have tried obtaining the name of the table but it displays the filterednew_ which is not very attractive to the client. 基本上,我希望能够显示或更改实体B和C的注释。我可以想到:a)能够在每条记录的顶部写入其实体名称,因此它类似于:候选:结果流:结果问题:我试图获取表的名称,但是它显示了filterednew_,这对客户端不是很有吸引力。 So, would I be able to cut that result so it only display everything after the underline? 因此,我是否可以削减结果,使其仅在下划线后显示所有内容?

b) Be able to change color according to the result. b)能够根据结果改变颜色。 For example, if note is from Entity B, then the table line would be of color red else the table line would be of color blue? 例如,如果注释来自实体B,那么表行将为红色,否则表行将为蓝色? PROBLEM: Since I am new to that and I am using XML, .rdl I can't think of a way to do that. 问题:由于我是新手,而且我正在使用XML,.rdl我想不出一种方法。

As the result obtained from select is kind of displayed in a foreach, I do not know how to add or differ whether result is from Entity B or C. 由于从select获得的结果显示在foreach中,因此我不知道如何添加或区分结果是否来自实体B或C。

My current report is displaying notes of entity B and C from a particular person but the result is not readable its all under notetext column without any separation. 我当前的报告显示的是来自某个特定人的实体B和C的注释,但结果无法在notetext列下全部读取,没有任何分离。

Would anyone know whether I could change the line colour according to whether its entity B or C, or even add a text to the top of results covering entity B, then another text for results covering entity C without losing much performance? 有人知道我是否可以根据其实体B或C来更改线条颜色,或者甚至在覆盖实体B的结果顶部添加一个文本,然后在覆盖实体C的结果上添加另一个文本而又不损失太多性能?

Simplest way would be to use the ObjecttypeName selected from Annotation, this will differentiate to who the notes belong\\associated to. 简单的方法是使用ObjecttypeName从注释中选择,这将分化谁音符所属\\关联。

Or you will require some reporting coding (if you want to do the colouring thing): 或者,您将需要一些报告编码(如果您想进行着色):

under Report >> Report Properties >> Code 报表>>报表属性>>代码下

create a function that will test for fieldname, you could pass a parameter as a string when selecting from whatever entity something like: 创建一个用于测试字段名称的函数,当从任何类似的实体中进行选择时,您可以将参数作为字符串传递:

SELECT B.*, 'B' as entityName FROM entityB B  --when from 'B' 
SELECT C.*, 'C' as entityBane FROM entity C  --when from 'C'

and call it entityName (used in my example below) or use the ObjecttypeCode in MSCRM to differentiate between owners of the Annotation\\Note. 并将其称为entityName(在下面的示例中使用)或使用MSCRM中的ObjecttypeCode来区分Annotation \\ Note的所有者。

Function NoteColor(ByVal entityName As String) As String
  If entityName = 'B' Then
    Return 'lightblue'
  Else
    Return 'grey'
  End If
End Function

Then on each cell, set the BackgroundColor as follows: 然后在每个单元格上,如下设置BackgroundColor:

=Code.NoteColor(Fields!['entityNane'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM