You need to sign in to do that
Don't have an account?

Displaying values from map in VF page and update the map values
Hi,
I want to display Values from map in VF and also update the values.
Public void getListAnswerMap(){
AnswerMap =new Map<String,List<Answer__c>>();
for (Answer__c a : [Select Id,C__c,Review__r.Dealer__r.Name,NC__c,R__c,Comment__c,Question1__r.Name,Question1__r.Section__c,Question1__r.Source_Document__c,Question1__r.Resp_Party__c from Answer__c]) {
if(AnswerMap.containsKey(a.Question1__r.Section__c)){
AnswerMap.get(a.Question1__r.Section__c);
}
else{
AnswerMap.put(a.Question1__r.Section__c, new List<Answer__c>());
}
System.debug('List of answers'+AnswerMap.size());
}
planskey=AnswerMap.Keyset();
System.debug('size of keys'+planskey);
keyslist = new List<String>();
List<String> keyslistTemp = new List<String>();
keyLableMap = new Map<String, String>();
keyslistTemp.add('Security Perfected');
keyLableMap.put('Security Perfected', Label.Security_Perfected);
keyslistTemp.add('Security Information Properly Documented');
keyLableMap.put('Security Information Properly Documented', Label.Security_Information_Properly_Documented);
keyslistTemp.add('Documentation');
keyLableMap.put('Documentation', Label.Documentation);
for(String keyName:keyslistTemp){
if(planskey.contains(keyName)){
keyslist.add(keyName);
System.debug('List of keys'+keyslist);
}
}
}
Here is a link to the docs explaining how to do this:
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_dynamic_vf_maps_lists.htm?SearchType=Stem
hi hanimi
here we have one way to dispaly the values from "Map".
below example is all values having in Map. so we need to go and display the as Key-Value pair.
i.e
<apex:pageBlockTable value="{!AnswerMap}" var="key">
<apex:column headerValue="Key Values">
{!key} <!-- display the key Values of map -->
</apex:column>
<apex:column headerValue="Values">
{!AnswerMap[key]} <!-- display the values of corresponding keys-->
</apex:column>
</apex:pageBlockTable>
Like that ,we need to display in Pageblock table................................