function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
betterbhushanbetterbhushan 

Get List value from a list in Map

public List<Map<String,Object>> getPhoneData() {
   List<Map<String, Object>> mapp = new List<Map<String, Object>>();
   Map<String, Object> temp = new Map<String, Object>{'type' => 'Account Phone', 'count' => new List<Integer>{[select count() from Account where Phone_valid__c = true], [select count() from Account where Phone != null]}};
   mapp.add(temp);
   Map<String, Object> temp1 = new Map<String, Object>{'type' => 'Account Fax', 'count' => [select count() from Account where Fax_valid__c = true]};
   mapp.add(temp1);
   Map<String, Object> temp2 = new Map<String, Object>{'type' => 'Contact Phone', 'count' => [select count() from Contact where Phone_valid__c = true]};
   mapp.add(temp2);
   Map<String, Object> temp3 = new Map<String, Object>{'type' => 'Contact Mobile', 'count' => [select count() from Contact where Mobile_valid__c = true]};
   mapp.add(temp3);
   Map<String, Object> temp4 = new Map<String, Object>{'type' => 'Contact Fax', 'count' => [select count() from Contact where Fax_valid__c = true]};
   mapp.add(temp4);
   Map<String, Object> temp5 = new Map<String, Object>{'type' => 'Contact Home Phone', 'count' => [select count() from Contact where Home_Phone_valid__c = true]};
   mapp.add(temp5);
   Map<String, Object> temp6 = new Map<String, Object>{'type' => 'Contact Other Phone', 'count' => [select count() from Contact where Other_Phone_valid__c = true]};
   mapp.add(temp6);
   Map<String, Object> temp7 = new Map<String, Object>{'type' => 'Lead Phone', 'count' => [select count() from Lead where Phone_valid__c = true]};
   mapp.add(temp7);
   Map<String, Object> temp8 = new Map<String, Object>{'type' => 'Lead Mobile', 'count' => [select count() from Lead where Mobile_valid__c = true]};
   mapp.add(temp8);
   Map<String, Object> temp9 = new Map<String, Object>{'type' => 'Lead Fax', 'count' => [select count() from Account where Fax_valid__c = true]};
       mapp.add(temp9);
   return mapp;
   }
   

 Now I want to iterate over Map in Visualforce Page whic I am doing like this:

 

            <apex:pageBlockTable title="Results" value="{!PhoneData}" var="d" >     
            <apex:column value="{!d['type']}" headerValue="Type" />
            <apex:column value="{!d['count']}" headerValue="Total"/>
           
            <apex:column value="{!d}" headerValue="everything"/>
            
          
            
            </apex:pageBlockTable><br/><br/><br/>

 Now, d['count'] is List. I want 1st value of this list 

 

say d['count'] = [1,2,3]

 

How will i get that value in VF? I tried d['count'].get(0)

aballardaballard

From your code I don't see why d['count'] would be a list, but if it is, you should be able to access the first element as d['count'][0]