问题描述
**我已创建控制器和vf页面以显示3列(对象,附件总数,ContentTypecount),其中附件计数列的值针对每种内容类型计数重复,因此我想隐藏或限制附件计数中的重复项列,并且每个对象仅显示一次**
my controller code:
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];
}}}
enter code here
my Visuaforce page code:
<table border="1">
<th>Object</th>
<th>Total Attachments</th>
<th>ContentType count</th>
<th>ContentType</th>
<apex:repeat value="{!results}" var="r">
<tr></tr>
<td> {!r['b']}</td>
<td>{!mapofObject[r['b']]}</td>
<td> {!r['c']}</td>
<td>{!r['type']}</td>
</apex:repeat>
</table>
**My OUTPUT
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
Expected OUTPUT:
Object TotalAttachments ContentTypecount
Contact 4 1
Contact 2
Contact 1
Opportunity 4 3
Opportunity 1
Opportunity 1
Account 3 2
Account 1 **
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)