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

Visualforce and Map issue.
Guys,
I'm creating a page which has three nested apex:repeat.
the first is for severtal content blocks -- APEX;REPEAT
the second is a table -- PAGEBLOCKTABLE
The third is the number of COLUMNS -- APEX:REPAT
VISUALFORCE
<apex:repeat value="{!SuperMap}" var="O" id="MapRepeat"> <apex:pageBlock title="Results for {!O}"> <apex:pageBlockTable value="{!SuperMap[O]}" var="R" id="RecordRepeat"> <apex:column headerValue="#"><apex:inputCheckbox value="{!R.rSelected}"/></apex:column> <apex:column headerValue="Score"><apex:outputText value="{!R.rScore}"/></apex:column> <apex:repeat value="{!FieldList[O]}" var="H" id="HeaderRepeat"> <apex:column headerValue="{!H}"><apex:outputText value="{!R.rObject[H]}"/></apex:column> </apex:repeat> </apex:pageBlockTable> </apex:pageBlock> </apex:repeat>
APEX CONTROLLER
public class Result { public String rId {get; set;} public Integer rScore {get; set;} public Boolean rSelected {get; set;} public sObject rObject {get; set;} } Map<String,List<Result>> SuperMap = new Map<String,List<Result>>(); Map<String,Map<String,String>> FieldList = new Map<String,Map<String,String>>(); // CONTENT FIELD LIST // {OBJECT NAME,{FieldName,FieldLabel}} // {Lead,{FirstName,First Name}},{Lead,{LastName,Last Name}} // CONTENT SUPER MAP // {OBJECT NAME,{{ID,SCORE,SELECTED,FULL OBJECT},{ID,SCORE,SELECTED,FULL OBJECT}}} // {Lead,{{00034798,98,false,{Lead:{FirstName:peter,LastName:de hond}}},{00034756,97,false,{Lead:{FirstName:peter,LastName:de hond}}}}
When i try to save this page it will crash with the following error.
Save error: Incorrect parameter for subscript. Expected Text, received core.apexpages.el.adapters.RuntimeTypeMetadataELAdapter
This error is triggered via the {!R.rObject[H]} part.
Please help!
I found the solution, workaround.
Instead of using the direct value of the {!H} map i used an extra visual force function.
This worked for me.
All Answers
You may have run into a bug. I know there are some issues with dynamic references and maps. Can you open a support case?
I filed a report to Salesforce support. But as i don't have a premier support plan my bug report doesn't get looked at...
Only got a reference to http://boards.developerforce.com/t5/Visualforce-Development/Compile-Error-in-a-Visualforce-Page-apex-pageBlockTable-and-a/m-p/343645
As you were into that discussion as wel Aballard, do you have a suggestion?
Thanks,
Sten
I found the solution, workaround.
Instead of using the direct value of the {!H} map i used an extra visual force function.
This worked for me.