I was originally building lists using dynamic query which works great, like so:
extension:
// initialize lead variables and columns
string leadFields = [SELECT lead_fields__c FROM demandramp_abm_config__c WHERE Name = 'Master' LIMIT 1].lead_fields__c;
leadCols = leadFields.split(',');
leadList = Database.query('SELECT id,' + leadFields + ' FROM Lead');
vf page:
<apex:pageBlockTable value="{!leadList}" var="rec" id="leadTable">
<apex:repeat value="{!leadCols}" var="FieldLabel">
<apex:column value="{!rec[FieldLabel]}"/>
</apex:repeat>
</apex:pageBlockTable>
I have run into collection size issues and now need to convert this to use a map but I'm having trouble and receiving error:
new extension:
// initialize lead variables and columns
string leadFields = [SELECT lead_fields__c FROM demandramp_abm_config__c WHERE Name = 'Master' LIMIT 1].lead_fields__c;
leadCols = leadFields.split(',');
LeadMap = new Map<id,lead>((List<lead>)Database.query('SELECT id,' + leadFields + ' FROM Lead'));
new vf page:
<apex:pageBlockTable value="{!leadMap}" var="rec" id="leadTable">
<apex:repeat value="{!leadCols}" var="FieldLabel">
<apex:column value="{!rec[FieldLabel]}"/>
</apex:repeat>
</apex:pageBlockTable>
The error:
Do I need to turn the list of column headers (leadCols) into a Map? How do I go about doing this and match it up with the columns?