TOC : Script API > JavaScript > JavaScript API > Component > Band > SubReportBand > Method >

 

GetDataSetSUM

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

TOC : Script API > JavaScript > JavaScript API > Component > Band > SubReportBand > 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.

 

 

 

Example :

 

//Data field (ODI name : Sample, dataset name : Orders, field name : Price)

 _TraceLn(This.GetDataSetSUM("Sample.Orders.Price"));

 

//ODI parameter field (ODI name : Sample, ODI parameter field name : TotalAmount)

 _TraceLn(This.GetDataSetSUM("Sample.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 :

 

GetDataSetValue