Subform Functions
For example, you may have a parent form which is a sales order, with a sub form containing the repeating order detail lines. Within the order detail, you could have a line total cost for each item. You may then want to total up all line item costs for each record as a grand total on the sub-form. In this example, you would use the DSUM function to calculate this value.
DCOUNT
Returns a count the number of sub form elements for g where h is not empty.
Syntax | Where | Result |
---|---|---|
DCOUNT(g, h) | g is a sub form unique name h is a unique name for an item on the sub form | A number |
Example | Result |
---|---|
=DCOUNT('Parts', 'Part reference') | Returns the number of records containing a non-empty 'Parts reference' within the sub-form 'Parts'. |
DSUM
Returns the sum of all of the sub-form elements h for each record in the sub-form g. h must be a widget containing a number.
Syntax | Where | Result |
---|---|---|
DSUM(g, h) | g is a sub form unique name h is a unique name for an item on the sub form | A number |
Example | Result |
---|---|
=DSUM('Parts', 'Part cost') | Returns the total value for all 'Parts cost' within the sub-form 'Parts'. |
DMAX
Returns the highest value of all the h items on all the sub forms for g. h must be a widget containing a number.
Syntax | Where | Result |
---|---|---|
DMAX(g, h) | g is a sub form unique name h is a unique name for an item on the sub form | A number |
Example | Result |
---|---|
=DMAX('Parts', 'width') | Returns the maximum value of width for each record within the sub-form Parts |
DMIN
Returns the smallest value of all the h items on all the sub forms for g. h must be a widget containing a number.
Syntax | Where | Result |
---|---|---|
DMIN(g, h) | g is a sub form unique name h is a unique name for an item on the sub form | A number |
Example | Result |
---|---|
=DMIN('Parts', 'Part cost') | Returns the minumum value of Part cost for each record within the sub-form Parts |
DAVERAGE
Returns the average value of all the h items on all the sub forms for g.
Syntax | Where | Result |
---|---|---|
DAVERAGE(g, h) | g is a sub form unique name h is a unique name for an item on the sub form | A number |
Example | Result |
---|---|
=DAVERAGE('Parts', 'Part Cost') | Returns the average value of Part cost for each record within the sub-form Parts |