You need to sign in to do that
Don't have an account?
Mariem Mejrissi
Display values in visualforce page
Hi Everyone,
Could someone please help me to get just the first value and remove other values.
private void getTargetList(List<Suricat_Segment__c> segmentList, Map<String, integer> countTargetMap, Map<String, List<Suricat_Segment__c>> targets){
Map<String, List<Suricat_Segment__c>> targetNameMap = new Map<String, List<Suricat_Segment__c>>();
Map<String, integer> countTarget ;
for (Suricat_Segment__c seg : segmentList){
if (targetNameMap.containsKey(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c)){
targetNameMap.get(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c).add(seg);
} else{
targetNameMap.put(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c, new List<Suricat_Segment__c>{ seg });
}
}
targets.putAll(targetNameMap);
}
<table class="liste-offres">
<thead>
<tr>
<th class="first_th">PRODOTTO PROMOZIONATO</th>
<th class="first_th">CONDIZIONI SCATENANTI</th>
<th class="first_th">QUANTITA’ PROMOZIONATA</th>
<th class="first_th">VALORE FACCIALE</th>
<th class="last_th">CODICE VALASSIS</th>
</tr>
</thead>
<tbody>
<apex:repeat var="mapKey" value="{!campaignWrapper.targets}">
<tr>
<!-- <td class="first_td" rowspan="{!campaignWrapper.countTargetMap}"> -->
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
{!mapValue.Suricat_Lever__r.Suricat_Product_Campaign__r.Name}
<br/>
</apex:repeat>
</td>
<td class="first_td ">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
{!mapValue.Suricat_Lever__r.Target__c}
<br/>
</apex:repeat>
</td>
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<apex:outputText value="{0, number, ###,###}">
<apex:param value="{!mapValue.UC_promoted__c}" />
<br/>
</apex:outputText>
</apex:repeat>
</td>
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<apex:outputText value="{!mapValue.VF__c}" />
<br/>
</apex:repeat>
</td>
<td class="last_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<br/>
<apex:outputText value="{!mapValue.Deal_Number__c}" />
</apex:repeat>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
Could someone please help me to get just the first value and remove other values.
private void getTargetList(List<Suricat_Segment__c> segmentList, Map<String, integer> countTargetMap, Map<String, List<Suricat_Segment__c>> targets){
Map<String, List<Suricat_Segment__c>> targetNameMap = new Map<String, List<Suricat_Segment__c>>();
Map<String, integer> countTarget ;
for (Suricat_Segment__c seg : segmentList){
if (targetNameMap.containsKey(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c)){
targetNameMap.get(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c).add(seg);
} else{
targetNameMap.put(seg.Suricat_Lever__r.Suricat_Product_Campaign__r.Name + '/' + seg.UC_promoted__c + '/' + seg.VF__c + '/' + seg.Deal_Number__c, new List<Suricat_Segment__c>{ seg });
}
}
targets.putAll(targetNameMap);
}
<table class="liste-offres">
<thead>
<tr>
<th class="first_th">PRODOTTO PROMOZIONATO</th>
<th class="first_th">CONDIZIONI SCATENANTI</th>
<th class="first_th">QUANTITA’ PROMOZIONATA</th>
<th class="first_th">VALORE FACCIALE</th>
<th class="last_th">CODICE VALASSIS</th>
</tr>
</thead>
<tbody>
<apex:repeat var="mapKey" value="{!campaignWrapper.targets}">
<tr>
<!-- <td class="first_td" rowspan="{!campaignWrapper.countTargetMap}"> -->
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
{!mapValue.Suricat_Lever__r.Suricat_Product_Campaign__r.Name}
<br/>
</apex:repeat>
</td>
<td class="first_td ">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
{!mapValue.Suricat_Lever__r.Target__c}
<br/>
</apex:repeat>
</td>
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<apex:outputText value="{0, number, ###,###}">
<apex:param value="{!mapValue.UC_promoted__c}" />
<br/>
</apex:outputText>
</apex:repeat>
</td>
<td class="first_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<apex:outputText value="{!mapValue.VF__c}" />
<br/>
</apex:repeat>
</td>
<td class="last_td">
<apex:repeat value="{!campaignWrapper.targets[mapKey]}" var="mapValue">
<br/>
<apex:outputText value="{!mapValue.Deal_Number__c}" />
</apex:repeat>
</td>
</tr>
</apex:repeat>
</tbody>
</table>