• Aaron Calderon 8
  • 0 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
//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 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
                     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