问题描述
我有一个控制器和visualforce页面,以显示3列(对象,TotalAttachmnentCount,ContentTypecount),其中对于每个ContentTypecount重复TotalAttachmnentCount值。我想在TotalAttachmnentCount中隐藏重复项,并为每个对象仅显示一次。
我的控制器代码
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];
}}}
我的Visuaforce页面代码
<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>
注意:{!results}从上述控制器功能馈送到表中
我的输出
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
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)