Sorting Distinct Values by Date_of_Invoice
Hey I have a table that I want to display, and right now it's sorting by the name of the trust or company so the data isn't in the correct order. I need the data to display by the invoice date, but I can't figure out for the life of me how to get it to display in the correct order.
The code so far is as follows:
- TrustDistinct = Finances[Display_Name == searchParam && Line_Item.containsIgnoreCase("Trust")].distinct(Line_Item);
- for each Expense in TrustDistinct
- {
- // Add all of same trust together to get total for each field
- DisbursementFromTrust = Finances[Display_Name == searchParam && Line_Item == Expense].sum(Amount);
- DisbursmentFromTrustFormatted = "$ " + DisbursementFromTrust.round(2);
- //TMCo is equal to Trust Management Company
- // listOfDates = List:date();
- // listOfDates.add(Finances[Display_Name == searchParam].Date_of_Invoice);
- // datesSorted = listOfDates.sort(false);
- DisbursementDateFromTrust = Finances[Display_Name == searchParam && Line_Item == Expense] sort by Date_of_Invoice;
- AttorneyFees = Finances[Display_Name == searchParam && Type == "Attorney Fees" && Line_Item == Expense].sum(Amount);
- AttorneyFeesFormatted = "$ " + AttorneyFees.round(2);
- AmountToClientExpenses = Finances[Display_Name == searchParam && Type == "Client Expenses" && Line_Item == Expense].sum(Amount);
- AmountToClientExpensesFormatted = "$ " + AmountToClientExpenses.round(2);
- //TotalBalancePaid = AttorneyFeesFormatted + AmountToClientExpensesFormatted;
- DisbursementToClient = Finances[Display_Name == searchParam && Type == "Disbursement to Client" && Line_Item == Expense].sum(Amount);
- DisbursementToClientFormatted = "$ " + DisbursementToClient.round(2);
- DisbursementToMedicare = Finances[Display_Name == searchParam && Type == "Medicare / Medicaid Liens" && Line_Item == Expense].sum(Amount);
- DisbursementToMedicareFormatted = "$ " + DisbursementToMedicare.round(2);
- //Check No. Need to configure
- //DateOfDisbursement = Finances[Display_Name == searchParam && Type == "Disbursement to Client" && Line_Item == Expense];
- //Trust = Finances[Display_Name == searchParam && Type == "Disbursement to Client"];
- %>
- <div class="divTableRow">
- <div class="divTableCell1"><%=Expense%></div>
- <div class="divTableCell1"><%=DisbursmentFromTrustFormatted%></div>
- <div class="divTableCell1"><%=AttorneyFeesFormatted%></div>
- <div class="divTableCell1"><%=AmountToClientExpenses%></div>
- <div class="divTableCell1"><%=DisbursementToMedicareFormatted%></div>
- <div class="divTableCell1"><%=DisbursementToClientFormatted%></div>
- <div class="divTableCell1"><%=DisbursementDateFromTrust.Date_of_Invoice%></div>
- </div>