• John Eichsteadt 1
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Applications Manager
  • PREM Group


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Query is returning the correct results in the Dev Console, but page table is blank.

APEX Class:
public class ContactUnitListController
{
  private ApexPages.StandardController controller {get; set;}
  private Contact a;
  public List<Account> ua;
  
  public ContactUnitListController(ApexPages.StandardController controller)
  {
    this.controller=controller;
    this.a = (Contact)Controller.getRecord();
  }
  
  public List<Account>getUnitList()
  {
    try
    {
      AccountContactRelation[] rel = [SELECT AccountId 
                           FROM AccountContactRelation
                           WHERE ContactId = :a.Id 
                           AND IsActive = true
                           ORDER BY CreatedDate DESC];
                           
      ua = [SELECT Id,Name,Property__c,Property__r.Name
        FROM Account 
        WHERE ParentId = :rel[0].AccountId 
        AND RecordTypeId = '0121a000000QCRBAA4' 
        ORDER BY CreatedDate DESC];
        
      return ua;
    }
    catch(Exception e)
        {
            system.debug('@@@@@@@@@@@@@@@@@@@@@'+e.getMessage()+' on line '+e.getLineNumber());
            
            return ua;
        }
    }
}

VF Page:

<apex:page docType="html-5.0" standardController="Contact" extensions="ContactUnitListController" showHeader="false" sidebar="false">        <apex:includeScript value="{!$Resource.json3}" />
 <body>
<apex:pageBlock title="Deeded Units">
<apex:pageBlockTable value="{!UnitList}" var="unit">
<apex:column >
<apex:facet name="header">Unit Number</apex:facet>
<apex:outputLink target="_blank" value="/{!unit.Id}">{!unit.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">Property</apex:facet>
<apex:outputLink target="_blank" value="/{!unit.Property__c}">{!unit.Property__r.Name}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</body>
</apex:page>

Can anyone tell me what I'm missing here? I'm guessing it's something simple.
In the Analyze Your Data Over Time module  where it says:

In the default exploration state, as you remember from the previous unit, the query is aggregating on count of rows with no grouping and no filtering. Start a new exploration by going back to the My DTC Sales app and opening the DTC Opportunity dataset. You’re interested in the number of tablets involved, so complete the following steps.
Click Count of Rows to change the measure.
Select Sum in the aggregation functions list.
Select # (number sign) for the measure to see the number of products in your closed opportunities

If I select Sum the only option is amout. Is the trailhead dataset in sync with the directions?