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
Steven Berg 5Steven Berg 5 

How do I Display Fields from the AccountContactRelation Object on a Visualforce page Using a subquery

I have the following Soql call in my controller:

public  with sharing class getAccountContactRelations {

public static list<account> getAccounts() {

  LIST <Account> MemberInfo = [SELECT Id, Name,  (SELECT Id,Contact.Name,Contact.Cardholder_Type__c,Contact.AccountId,
                                             Contact.email,Contact.MailingAddress,Contact.City_Secondary__c,Contact.Zip_Code_Secondary__c,Contact.State_Secondary__c,
                                             Contact.MobilePhone,Account.name
 FROM AccountContactRelations where Contact.Cardholder_Type__c = 'Authorized' Or Contact.Cardholder_Type__c = 'Primary' ) 
 FROM Account WHERE Id = '001M000000xMs8V'];

                                                                                                     
                                                   return MemberInfo;
                                          
                                            }       
                 }



My Visualforce page has the following code:

<apex:page controller="getAccountContactRelations">

<apex:pageblock>
<apex:pageblockTable value="{!Accounts}" var="a"> 
<apex:pageblockTable value="{!a.AccountContactRelations}" var="r">

<apex:column headerValue="City" value="{!r.Contact.City_Secondary__c}"/>

</apex:pageblockTable>
</apex:pageblockTable>

</apex:pageblock>
</apex:page>

The Object has values but they are not being displayed on the Visualforce page.
How should my visualforce page be coded so I can see the results of my subquery?
Thank you
Ramssf70Ramssf70
Hi Steven Berg 5,

Did you check values are coming into MemberInfo list or not.

Thank you