Subform Functions

If you're using sub-forms, WorkMobile provides a set of functions that can be called within the parent form in order to perform aggregations on the records within the sub-form.

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.

SyntaxWhereResult
DCOUNT(g, h)g is a sub form unique name
h is a unique name for an item on the sub form
A number

 

ExampleResult
=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.

SyntaxWhereResult
DSUM(g, h)g is a sub form unique name
h is a unique name for an item on the sub form
A number

 

ExampleResult
=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.

SyntaxWhereResult
DMAX(g, h)g is a sub form unique name
h is a unique name for an item on the sub form
A number

 

ExampleResult
=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.

SyntaxWhereResult
DMIN(g, h)g is a sub form unique name
h is a unique name for an item on the sub form
A number

 

ExampleResult
=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.

SyntaxWhereResult
DAVERAGE(g, h)g is a sub form unique name
h is a unique name for an item on the sub form
A number

 

ExampleResult
=DAVERAGE('Parts', 'Part Cost')Returns the average value of Part cost for each record within the sub-form Parts