I can display values from a List in VF Page 'repeat', in the System.debug() the list is displaying the values. I have two question: why my vf is empty and also is there any way to NO show duplicate values for example I am getting:
USER_DEBUG [50]|DEBUG|(7x4x4 Qty 54)
USER_DEBUG [50]|DEBUG|(7x4x4 Qty 54)
USER_DEBUG [50]|DEBUG|(10x4x5 Qty 20)
USER_DEBUG [50]|DEBUG|(10x4x5 Qty 20)
Below is my controller code:
public class SO_1_Controller {
private ApexPages.StandardController std;
public List<SO_Detail__c> SODetails {get; set;}
public string values{get;set;}
public string supplySize2{get;set;}
public List<String> List1{get;set;}
public SO_1_Controller(ApexPages.StandardController stdCtrl) {
std=stdCtrl;
SODetails=[select id, Name, X1__c, NRProducts__r.Supplies__r.Size__c
from SO_Detail__c
where OSO_ID__c=:std.getId()
order by Name asc];
Map<String, Decimal> supplySizeToQtySumMap = new Map<String, Decimal>();
for ( SO_Detail__c product : this.SODetails ) {
Decimal qtySum = 0;
String supplySize = product.NRProducts__r.Supplies__r.Size__c;
if(supplySizeToQtySumMap.containsKey(supplySize)) {
qtySum = supplySizeToQtySumMap.get(supplySize);
}
qtySum += product.X1__c;
supplySizeToQtySumMap.put(supplySize, qtySum);
}
for ( SO_Detail__c product : this.SODetails ) {
supplySize2 = product.NRProducts__r.Supplies__r.Size__c;
values = supplySize2 + ' Qty ' + String.valueof(supplySizeToQtySumMap.get(supplySize2));
List<String> list1 = new List<String>();
List1.add(values);
System.debug(List1);
}
}
public List<String> getList1() {
if ( List1 != NULL )
return List1;
else
return null;
}
}
Visual force page to display the total box size:
<apex:outputPanel layout="block" styleClass="LinesTable2">
<table id="apppp">
<tr><th>Total Boxes</th></tr>
<apex:repeat var="d" value="{!List1}">
<tr><td><apex:outputText value="{!d}"/></td></tr>
</apex:repeat>
</table>
</apex:outputPanel>