You need to sign in to do that
Don't have an account?
ericmonte
Nested Query and Visualforce page
Hey all I am having a hard time trying to figure out the count of the number of child records in my Parent Record and displaying it in my Visualforce.
Here is my current Query
public class myController{ public List <account> accList {get;set;} public myController { accList = [select id, Name, (Select id, Name from Addresses__r) from Account]; } And my visualforce Page will look like this <apex: repeat value="{!accList}" var="a"> ID: {!a.Id} Name: {!a.Name} Number of Child Records: {!getCountChild} <apex:repeat value="{!a.Addresses__r}" var="add"> Address info id: {!add.Id} Address Name: {!add.Name} </apex:repeat> </apex:repeat>
Any help would be great on this, I've been stuck on this for weeks.
Thanks
Hi ericmonte,
Please have a look on the piece of apex script written below to get count of child records-
If you did not get your solution please let me know,If this was your requirment then don't forget to mark as solve to help other!
--
Thanks
Usman
All Answers
Hi ericmonte,
Please have a look on the piece of apex script written below to get count of child records-
If you did not get your solution please let me know,If this was your requirment then don't forget to mark as solve to help other!
--
Thanks
Usman
hey MoUsman thanks for reply, but I'm kind of confuse on how you are using: {!getCountChildvar}? Are you taking this value from the controller?
Please remove your that particular line from your code.I was forget to remove that!!
Thanks
Usman
that worked! i knew there was an easier way to this count rather than creating a for loop!!!
THANKS!! now i can sleep easy tonight :)
Don't forget to give a Kudos :P
Thanks!