You need to sign in to do that
Don't have an account?
Rudi_Hulsbos
Map key null not found in map
Hi,
I am trying to display a map with map values in a visualforce page but keep getting Map key null not found in map error:
Controller:
public MAP<Quote,LIST<QuoteLineItem>> getQuotes(){
quotelistmap = new MAP<Quote,LIST<QuoteLineItem>>();
for(Quote getquotes : [SELECT Id, Name, Product__c, Product_Category__c, Total_Price_Incl__c,
(SELECT Id, Description FROM QuoteLineItems)
FROM Quote WHERE Opportunity.Link_to_Main_Opportunity__c = :o.Id]){
quotelistmap.put(getquotes,getquotes.QuoteLineItems);
system.debug('quotelistmap: '+quotelistmap);
}
return quotelistmap;
}
Visualforce Page:
<apex:dataTable value="{!Quotes}" var="q">
<apex:column value="{!q.Product_Category__c}"/>
<apex:column value="{!q.Product__c}"/>
<apex:repeat value="{!Quotes[q]}" var="qli">
<apex:column value="{!qli.Id}" />
</apex:repeat>
</apex:dataTable>
Error Message:
Map key null not found in map
Error is in expression '{!Quotes[q]}' in component <apex:dataTable> in page quoteswithquotelineitems
I have searched the community and found some community members doing the exact same thing.
Please help?
Thanks,
Rudi
I am trying to display a map with map values in a visualforce page but keep getting Map key null not found in map error:
Controller:
public MAP<Quote,LIST<QuoteLineItem>> getQuotes(){
quotelistmap = new MAP<Quote,LIST<QuoteLineItem>>();
for(Quote getquotes : [SELECT Id, Name, Product__c, Product_Category__c, Total_Price_Incl__c,
(SELECT Id, Description FROM QuoteLineItems)
FROM Quote WHERE Opportunity.Link_to_Main_Opportunity__c = :o.Id]){
quotelistmap.put(getquotes,getquotes.QuoteLineItems);
system.debug('quotelistmap: '+quotelistmap);
}
return quotelistmap;
}
Visualforce Page:
<apex:dataTable value="{!Quotes}" var="q">
<apex:column value="{!q.Product_Category__c}"/>
<apex:column value="{!q.Product__c}"/>
<apex:repeat value="{!Quotes[q]}" var="qli">
<apex:column value="{!qli.Id}" />
</apex:repeat>
</apex:dataTable>
Error Message:
Map key null not found in map
Error is in expression '{!Quotes[q]}' in component <apex:dataTable> in page quoteswithquotelineitems
I have searched the community and found some community members doing the exact same thing.
Please help?
Thanks,
Rudi
It's better if you can convert the Key value to a String & then add to the map.
For more information:
http://force201.wordpress.com/2012/11/19/only-some-types-work-as-apex-map-keys-from-visualforce/