For each only outputting last and single record in set

For each only outputting last and single record in set

Hi all,

I have created a simple function that sends an email to admin when a member of staff requests some stock items. It's all working perfectly, however, I must be doing something wrong as it's only outputting the latest and one row, whereby sometimes it can be 3 + items.

Foreach Loop:
  1. for each  r in itemsSubform[ParentID == requisitionCollection.ID]
  2. {
  3. cat = Stock_Categories[ID == r.Category].itemCategory;
  4. subcat = Stock_Sub_Categories[ID == r.Sub_Category].Sub_Category1;
  5. // Output
  6. items = "[" + cat + "] " + r.Qty + " " + subcat + " (" + r.Status + ")";
  7. }
I use this to output to the email as shown below:
  1. sendmail
  2. [
  3. from :"admin email address"
  4. to :"user email address"
  5. subject :"New Requisition: " + personnelCollection.combined_name + " (" + requisitionCollection.Added_Time + ")"
  6. message :"<div>New Requisition</div><div><br/><br/><b>Item(s): </b><br/>" + items + "<br/><br/><b>Remarks</b><br/>" + reqRemarks + "</div>"
  7. ]
Can anyone shed any light on what I am doing wrong? Do I need multiple loops or am I misunderstanding this totally?

Thanks