<< Click to Display Table of Contents >> Navigation: »No topics above this level« TOC : Script API > JavaScript > JavaScript API > Component > Multiplex > Table > Method >GetDataSetSUM |
Gets the sum from the given field.
Prototype :
double GetDataSetSUM
(
string FieldPath
[ string DistinctFieldName ],
[ string ConditionFieldName ]
)
Arguments :
FieldPath |
Field Path setup depends on the field type |
DistinctFieldName |
Field name for deduplication |
ConditionFieldName |
Field name for search condition |
Reference :
Refer to GetDataSetValue function for how to set the field path.
To remove duplicate values from calculating the sum of a field values, specify the field using DistinctFieldName.
To calculate the sum of data field values of which conditional field value is true, specify the condition field using ConditionFieldName.
Value of true and false depends on types of conditional field :
• Bit type (Boolean)
False if 0 or false, and true if 1 or true.
• Numeric type
False if 0, and true otherwise.
• Other types
Recognized as string type. False if null, false, no, f, n, '0', '0.0', '.0' (not case sensitive) and true otherwise.
When execute the function in the table created in a data band having group header/footer bands, a group header/footer band and a data sub-band, if the function use the dataset field of its band, the return value may be different according to each band. To learn more, refer to description of GetDataSetSUM of each band.
Example :
//Data field (ODI name : Sample, dataset name : Orders, field name : Price)
_TraceLn(This.GetDataSetSUM("Sample.Orders.Price"));
//Data field (ODI name and dataset name can be omitted)
_TraceLn(This.GetDataSetSUM("Orders.Price")); //omit ODI name
_TraceLn(This.GetDataSetSUM("Price")); //omit ODI name and dataset name
//ODI parameter field (ODI name : Sample, ODI parameter field name : TotalAmount)
_TraceLn(This.GetDataSetSUM("Sample.OZParam.TotalAmount"));
//ODI parameter field (ODI name can be omitted)
_TraceLn(This.GetDataSetSUM("OZParam.TotalAmount"));
//Data field (specify DistinctFieldName)
_TraceLn(This.GetDataSetSUM("Price", "Region"));
//Data field (specify ConditionFieldName)
_TraceLn(This.GetDataSetSUM("Price", "", "Flag"));
//Data field (specify DistinctFieldName and ConditionFieldName)
_TraceLn(This.GetDataSetSUM("Price", "Region", "Flag"));
Available Events :
OnBind, OnStartBind
See also :