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
iKnowSFDCiKnowSFDC 

Displaying values from map in VF page

I'm trying to display some values in a data table and am getting the following error:  

Incorrect parameter for subscript. Expected java.lang.Class, received Text

 

The VF code is as follows: 

    <apex:datatable value="{!bom}" var="cmps" width="650px" border=".5px">
    <apex:column headerValue="Top Level Product" >
            <apex:outputField value="{!cmps.Top_Level_Product__c}"/>
        </apex:column>
        <apex:column headerValue="Top Level Product" >
            <apex:outputField value="{!cmps.Top_Level_Product__r.ProductCode}"/>
        </apex:column>
        <apex:column headerValue="Manufacturer's Part Number">
            <apex:outputField value="{!cmps.Component__r.Product_Code__c}"/>
        </apex:column>
        <apex:column headerValue="Quantity" style="text-align:center;">
            <apex:outputField value="{!pcQty[cmps.id]}"/> 
        </apex:column>  
        <apex:column headerValue="Description">
            <apex:outputField value="{!cmps.Component__r.Component_Description__c}"/>
        </apex:column>
</apex:datatable>

 I am not sure how to solve this so that the quantity value in my map is displayed instead. 

 

Thanks for your help.

JoAnn

Best Answer chosen by Admin (Salesforce Developers) 
Chamil MadusankaChamil Madusanka

Refer following link. This is a good example for dynamic Map binding from Bob

 

http://bobbuzzard.blogspot.com/2011/03/visualforce-dynamic-map-bindings.html

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

All Answers

Chamil MadusankaChamil Madusanka

Refer following link. This is a good example for dynamic Map binding from Bob

 

http://bobbuzzard.blogspot.com/2011/03/visualforce-dynamic-map-bindings.html

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

This was selected as the best answer
Sunny670Sunny670
Can you post the solution here please