Only getting one record returned in my Page script

Only getting one record returned in my Page script

Hello, 

I am having a hard time figuring out this script for a page I am creating.  As far as I can tell, it should be returning several values, but I only get one record returned. 

I am trying to get all the expenses for owner Kathi and show the payee and amount.  When I write my script and access the page, I only get the last record to appear in the table.  I do not understand. 

Can you look at my script and tell me what I might be doing wrong? 

htmlpage expense_test()

displayname = "expense test"

content

<%{

           KathiExpenses = Add_Expense[Owner == "Kathi"];

           for each  KE in KathiExpenses

           {

                      KPayee = KE.Payee_To_Text;

                      KAmount = KE.Amount;

           }

           %>

<br><table style="width: 100%; font-size: 10pt;" border="1" cellspacing="2" cellpadding="2"><tbody><tr><td><%=KPayee%></td><td><%=KAmount%></td></tr></tbody></table><br><br>

<%

 

}%>

 

Thanks for your help. 

Michael Custer