Salesforce 如何删除visualforce页面中的重复单元格项
我有一个控制器和visualforce页面来显示3列(对象、TotalAttachmentCount、ContentTypecount),其中TotalAttachmentCount值对每个ContentTypecount重复。我想在TotalAttachmentCount中隐藏重复项,并为每个对象仅显示一次 我的控制器代码Salesforce 如何删除visualforce页面中的重复单元格项,salesforce,apex,visualforce,lightning,sfdc,Salesforce,Apex,Visualforce,Lightning,Sfdc,我有一个控制器和visualforce页面来显示3列(对象、TotalAttachmentCount、ContentTypecount),其中TotalAttachmentCount值对每个ContentTypecount重复。我想在TotalAttachmentCount中隐藏重复项,并为每个对象仅显示一次 我的控制器代码 public Map<String, integer> mapofObject {set;get;} public MyController(){
public Map<String, integer> mapofObject {set;get;}
public MyController(){
mapofObject = new Map<String, integer>();
for(AggregateResult at:[select Parent.Type b,count(id) from Attachment group BY Parent.Type]){
String Name = (string)(at.get('b'));
integer a = (integer)at.get('expr0');
mapofObject.put(Name,a);
}
}
public AggregateResult[] results {
get {
return [select Parent.Type b,Count(id) c,ContentType type from Attachment group By Parent.Type,ContentType];
}}}
<table border="1">
<th>Object</th>
<th>Total Attachments</th>
<th>ContentType count</th>
<apex:repeat value="{!results}" var="r">
<tr></tr>
<td> {!r['b']}</td>
<td>{!mapofObject[r['b']]}</td>
<td> {!r['c']}</td>
</apex:repeat>
</table>
预期产出
Object Total Attachments ContentTypecount
Contact 4 1
Contact 4 2
Contact 4 1
Opportunity 4 2
Opportunity 4 1
Opportunity 4 1
Account 3 2
Account 3 1
Object TotalAttachments ContentTypecount
Contact 4 1
Contact 2
Contact 1
Opportunity 4 2
Opportunity 1
Opportunity 1
Account 3 2
Account 1
每个sObject的总计是否必须是一个单独的列?如果它可以是一个小计行(如在报告中),那么使用
分组汇总可以非常轻松地完成它: