You need to sign in to do that
Don't have an account?
Passing values in custom controller from one method to another
I am somewhat of a newbie to Apex and VF, so I will explain my issue in pseudo code.
I have three custom objects (Applications, Enrollments, Tests) that are children of the Contact object. I would like to create a Visual Force page that displays information for all Applications that have a Status of 'Incomplete'. All custom objects have a Contact__c field associated to them so I can reference the Contact object from any of them.
Here is the issue: Not all Enrollments and Tests are associated with the Application object, but all are associated with the Contact object. So I need to query for all 'Incomplete' Applications in my custom controller and use the Contact__c reference to query Enrollments and Tests. Then display the information in a table on the VF page.
So I have two trains of thought:
This does not work...
- Select FirstName, LastName,(Select <application_fields> from Application),(Select <enrollment_fields> from Enrollments),(Select <test_fields> from Tests) From Contact Where Application__r.Status = 'Incomplete'; OR
- Select Contact__c from Application Where Application.Status = 'Incomplete';
for (incomplete_apps)
{
contact_id = incomplete_apps.Contact__c;
Select Name from Enrollments where Contact__c = :contact_id;
Select Name from Tests where Contact__c = :contact_id;
}
If I do #2, how do I reference the Enrollments and Tests on the VF page since the page is calling the getMethod for the Application?
Hope this makes sense????
Thanks,
Jeff