Help with "Average" Aggregate Function

Help with "Average" Aggregate Function

Hi all:

I'm new to scripting in Deluge and have a question:

How do I fetch only related records located in a sub-form (a.k.a. a related form) and then calculate the average of a specific field in that sub-form?

Specifically, I need to know how to write the "criteria expression" part so it only finds those fields related to the parent form ( not all records).

I'm using the Fetch Records drag-n-drop function wizard. The pure Deluge Script syntax is...

  1. //to find the average of a numeric field for specific records 
  2. <variable> = <Form_Name>[criteria expression].avg (<Numeric Field Name>);
What do I put into the "criteria expression" field in the form wizard so it only fetches related records?

Thanks in advance,
Matt