如何解决我需要限制Visualforce页面中单列单元格值的重复值
**我已创建控制器和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 举报,一经查实,本站将立刻删除。