Use this function to return the decimal sum of a group of fields which have names that begin with common characters.
SUM (PartialName, Section, Form, Group)
Parameter |
Description |
PartialName |
Enter a valid string. The string must be the common (prefix) portion of a set of field names that occur on the current section. The default is the current field. |
Section |
Enter the name of a section that contains the field you specified. The default is the current section. |
Form |
Enter the name of a form that contains the section and/or field you specified. The default is the current form. |
Group |
Enter the name of the form group that contains the form, section, and/or field you specified. The default is the current group. |
The system calculates and returns the accumulated values of all fields that begin with the specified partial name.
An example of field names that have a common start are:
Myfield1
Myfield2
Myfield20
Each of these fields will be included if the partial name is specified using any of the leading characters of myfield. The first field will be excluded if you enter myfield2, but will match the other two field names.
Note | Include the Partialname parameter. Fields must have unique names within a section. Using the default will probably not give the expected result, unless you created the form and understand the naming conventions. |
Here are some examples:
This table is used by the examples. The table represents the layout of two forms in the same group. Both forms share two sections (IMG A and IMG B). Each section has fields of the same name as a field in the other section.
Field |
Section |
Form |
Group |
Value |
MyField1 |
IMG A |
FRM A |
GRP |
100.24 |
MyField2 |
IMG A |
FRM A |
GRP |
200.16 |
MyField1 |
IMG B |
FRM A |
GRP |
98.60 |
MyField2 |
IMG B |
FRM A |
GRP |
* no value yet * |
MyField1 |
IMG A |
FRM B |
GRP |
0.00 |
MyField2 |
IMG A |
FRM B |
GRP |
* no value yet * |
MyField1 |
IMG B |
FRM B |
GRP |
70.77 |
MyField2 |
IMG B |
FRM B |
GRP |
* no value yet * |
(Assume the current field is MyField1, on the first section of the first form. Reference the previous table for field values.)
Function |
Result |
Explanation |
SUM ( ) |
100.24 |
Without any other information, the function assumes the current field and section. There will only be one value included in the sum. |
SUM ("Myfield2") |
200.16 |
Again, there is only one field included in this result. |
SUM("MyField") |
300.40 |
In this example, the current section contains two fields that begin with the name "MyField". The equation is as follows: (100.24 + 200.16). |
SUM("MyField", "IMG B") |
98.60 |
Although two fields on IMG B have a matching name, only one field actually has a value. |
SUM("MyField", , "FRM A") |
399.00 |
No section is specified in this example, so the entire form is searched. Four fields match the name criteria, but only three have values: (100.24 + 200.16 + 98.60). |
SUM("MyField", "IMG B", , "GRP") |
169.37 |
This example specifies a section and group, but no form. There are four fields that match the name criteria, but only two have values: (98.60 + 70.77). |
SUM("MyField", , , "GRP") |
469.77 |
This example names the group without a form or section. Eight fields meet the naming criteria, but only five fields actually have values: (100.24 + 200.16 + 98.60 + 0.00 + 70.77). |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.