• Aaron Calderon 8
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
//Visualforce page for pageBlockTable

<apex:page standardController="Loan__c" extensions="AmoSchedRelatedListExtension">
    <apex:pageBlock title="">
        <apex:pageBlockTable value="{!Loan__c.amortization_line_items__r}" var="ali">
            <apex:column value="{!ali.Period__c}"/>
            <apex:column value="{!ali.Month__c}"/>
            <apex:column value="{!ali.Principal_Balance__c}"/>
            <apex:column value="{!ali.Monthly_Payment1__c}"/>
            <apex:column value="{!ali.Interest__c}"/>
            <apex:column value="{!ali.Principal_Payment__c}"/>
            <apex:column value="{!ali.Consulting_Fee__c}"/>
            <apex:column value="{!ali.Adjusted_Principal__c}"/>
            <apex:column value="{!ali.Adjusted_Consulting_Fee__c}"/>
            <apex:column value="{!ali.Total_Payment__c}"/>
            <apex:column value="{!ali.Remaining_Principal_Balance__c}"/>
            <apex:column value="{!ali.Interest_Payments_Received__c}"/>
            <apex:column value="{!ali.Consulting_Fee_Payments_Received__c}"/>
            <apex:column value="{!ali.Principal_Payments_Received__c}"/>
            <apex:column value="{!ali.Total_Payments_Received__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
 
//Apex Class attempting to order the block table in ascending order by Period

public with sharing class AmoSchedRelatedListExtension
{
    private final Id loanId;
    public List<Amortization_Line_Item__c> alis { get; set; }
 
    public AmoSchedRelatedListExtension(ApexPages.StandardController stdController)
    {
        loanId = stdController.getId();
        alis = [select Id
                              ,Period__c
                              ,Month__c
                              ,Principal_Balance__c
                              ,Monthly_Payment1__c
                              ,Interest__c
                              ,Principal_Payment__c
                              ,Consulting_Fee__c
                              ,Adjusted_Principal__c
                              ,Adjusted_Consulting_Fee__c
                              ,Total_Payment__c
                              ,Remaining_Principal_Balance__c
                              ,Interest_Payments_Received__c
                              ,Principal_Payments_Received__C
                              ,Consulting_Fee_Payments_Received__c
                              ,Total_Payments_Received__c
                     from Amortization_Line_Item__c
                   where Loan__c =:loanId
               order by Period__c ASC];
    }
}
Hi everyone,

I'm attempting to add a visualforce page to a lightning record page that displays the related Amortization Line Items of a Loan. Both Loan and Amortization Line Item are custom objects. My intent is to use apex:pageBlockTable to display the related list with more than the standard 10 columns (if there is a better way to achieve this, please  recommend).

As you can see my code above, I have the visualforce page and an apex class which I was hoping would correctly order by period ascending (starting at 1 or 0, depending on the loan). 

On one record, it almost worked but it started at period 4, listed the remaing rows correctly until the final period 36 and then just had no order to it for periods 2, 3, and 1. Other records just order by Period descending.

Any help is much appreciated. Thank you!
User-added image
User-added image