Aggregate values from multiple entries in a form

Aggregate values from multiple entries in a form

Hi,

I am trying to get the aggregate value of a field from multiple forms.

My Stock Out form has the following fields:
1. Sale order number
2. Product code
3. Quantity
For a single sale order I will have multiple entries in product code and quantity.

I have a separate form to print dispatch slip, which needs to have the total quantity for each sale order. How to get this?