<< Click to Display Table of Contents >> Navigation: »No topics above this level« TOC : Script API > JavaScript > JavaScript API > Component > Multiplex > Table > Method >GetDataSetAVG |
Gets the average from the given field.
Prototype :
double GetDataSetAVG
(
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.
Refer to GetDataSetSUM function for using DistinctFieldName and ConditionFieldName.
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 GetDataSetAVG of each band.
Example :
//Data field (ODI name : Sample, dataset name : Orders, field name : Price)
_TraceLn(This.GetDataSetAVG("Sample.Orders.Price"));
//Data field (ODI name and dataset name can be omitted)
_TraceLn(This.GetDataSetAVG("Orders.Price")); //omit ODI name
_TraceLn(This.GetDataSetAVG("Price")); //omit ODI name and dataset name
//ODI parameter field (ODI name : Sample, ODI parameter field name : TotalAmount)
_TraceLn(This.GetDataSetAVG("Sample.OZParam.TotalAmount"));
//ODI parameter field (ODI name can be omitted)
_TraceLn(This.GetDataSetAVG("OZParam.TotalAmount"));
//Data field (specify DistinctFieldName)
_TraceLn(This.GetDataSetAVG("Price", "Region"));
//Data field (specify ConditionFieldName)
_TraceLn(This.GetDataSetAVG("Price", "", "Flag"));
//Data field (specify DistinctFieldName and ConditionFieldName)
_TraceLn(This.GetDataSetAVG("Price", "Region", "Flag"));
Available Events :
OnBind, OnStartBind
See also :
GetDataSetSUM, GetDataSetValue