You need to sign in to do that
Don't have an account?
Alex Makk
Display Summary table that is grouped by 2 fields
Hello, I'm trying to figure out how to get the summary table that will break down data by building, then by the station. At the bottom of each group, it should show subtotals. The last row should display totals per table.
Here is what the end result should look like:
Here is what I have now:
Here is my controller:
Here is what the end result should look like:
Here is what I have now:
Here is my controller:
public Map<String, StationListWrapper> getStationTracking() { Map<String, StationListWrapper> StationTracking = new Map<String, StationListWrapper>(); if (logisticId != null) { List<Station_Tracking_Metrics__c> st = [SELECT Building_Area_Name__c, Name, Product_Name__c, Picked_Up__c, Delivered__c FROM Station_Tracking_Metrics__c WHERE EPUD__c = :logisticId]; for(Station_Tracking_Metrics__c s: st){ if(null == s.Building_Area_Name__c) continue; StationListWrapper wrapper = StationTracking.get(s.Name); if(wrapper == null){ StationTracking.put(s.Name, new StationListWrapper(new List<Station_Tracking_Metrics__c>())); } StationTracking.get(s.Name).stationList.add(s); } } return StationTracking; }Here is my VF page component:
<apex:attribute name="LogId" type="String" description="Id of the EPUD" assignTo="{!logisticId}"/> <table width="200px"> <tr> <th>Station</th> <th>Product</th> <th>Picked Up</th> <th>Delivered</th> </tr> <apex:repeat value="{!StationTracking}" var="key"> <apex:repeat value="{!StationTracking[key].stationList}" var="keyvalue"> <tr> <td RowSpan="{!StationTracking[key].numOfStations}" Style="display:{!IF(CASESAFEID(keyvalue.id)==CASESAFEID(StationTracking[key].firstOfList), 'table-data','none')};">{!keyvalue.name}</td> <td>{!keyvalue.Product_Name__c}</td> <td>{!keyvalue.Picked_Up__c}</td> <td>{!keyvalue.Delivered__c}</td> </tr> </apex:repeat> </apex:repeat> </table>Please let me know if you have any ideas on how to achieve this. Thank you.