You need to sign in to do that
Don't have an account?
Iago Felicio
How to access in a visualforce page a Map of a Set
My Map looks like this:
Considerations:
If I access myMap in my controller by using the solution below I access the infos I need. But, I need to access it in my page.
myMap = Map<Id,Set<myObject__c>>If I try to access the collection of myObject__c by using the following:
<apex:repeat value="{!myMap[exampleofID]}" var="myobject"> <apex:repeat value="{!myobject}" var="myset">I get null in myset.
Considerations:
If I access myMap in my controller by using the solution below I access the infos I need. But, I need to access it in my page.
myMap.get(Id).keyset()Pleeease, someone help me!
APEX Code VF Page
All Answers
You just need one apex:repeat, because {!myMap[exampleofID]} returns only one set.
Your code will be something like this.
Let me know if this helps.
Please find below code .
Regards ,
Harish.R.
@LBK thank you very much for your reply. However, when I try your solution I do get the ID of myobject but when I try to access myobject.Name it gives me an error saying that a String.Name is null.
I'm getting only the ID of the object.
The biggest problem is that there is another part of my project that I do what you suggest and it works. Do you have any idea why this could happen?
@Harish rao 25, I appreciate your reply as well. I'll still try your solution and later I give a follow up here.
Unlike the default lists you get in triggers (Trigger.New and Trigger.Old), the SETs and LISTs we fetch in our code carries only the fields that we fetch.
Are you using an SOQL query to populate Set<myObject__c>?
If so, please make sure your SOQL query returns all the fields you would want to use in your VF page.
APEX Code VF Page
It turns out my real problem was that I didn't give the right permissions to get access to the object! I just needed to change the profile settings of the user I was logged in.
both ideas would solve my problems! So thanks a lot @LBK and @Harish rao 25.