[파워빌더.DataWindow - 계산하기 ]
|
데이터 윈도우의 sum() 함수 expression 에서 자주 사용하는데요..
for range 뒤에 distinct 를 붙일 수 있더군요... ;
그렇게 하니까 그룹내에서 중복으로 값이 더해지는 걸 예방할 수 있더군요.
참고로 first() 함수도 있더군요...
다음은 헬프의 내용입니다.
Description
Calculates the sum of the values in the specified column.
열거된 컬럼의 값을 합하여 계산한다.
Syntax
Sum ( column { FOR range { DISTINCT { expres1 {, expres2 {, ... } } } } } )
Argument |
Description | ||||||||||||
column |
The column for which you want the sum of the data values. Column can be the column name or the column number preceded by a pound sign (#). Column can also be an expression that includes a reference to the column. The data type of column must be numeric. 컬럼 타입은 반드시 숫자형이여야 하고, 컬럼명이 와도 되고, 컬럼번호가 와도 된다. 또는 표현식도 가능하다. | ||||||||||||
FOR range (optional) |
The data to be included in the sum. For most presentation styles, values for range are:
| ||||||||||||
DISTINCT (optional) |
Causes Sum to consider only the distinct values in column when determining the sum. For a value of column, the first row found with the value is used and other rows that have the same value are ignored. 합계를 구할 때 컬럼내에서 중복되는 값을 제거하여 합계를 구한다. 동일한 값이 존재할 때, 첫번째 row의 값만 가져오고, 다른 row의 동일한 값은 무시한다. | ||||||||||||
expresn (optional) |
One or more expressions that you want to evaluate to determine distinct rows. Expresn can be the name of a column, a function, or an expression. 값을 계산하기 위해서 사용하는 하나 또는 여러개의 표현식 내용은 distinct 의 조건으로 사용된다. 표현식은 컬럼명이나 함수, 또는 수식등을 사용할 수 있다. 예) sum( 컬럼명 for all distinct 컬럼명이나 함수, 수식)
|
Return value
The appropriate numeric data type. Returns the sum of the data values in column.
숫자형타입 중 알맞은 형태가 리턴된다. integer 는 interger, decimal은 decimal...머..이렇다는 말인가보다.
Usage
If you specify range, Sum returns the sum of the values in column within range. If you specify DISTINCT, Sum returns the sum of the distinct values in column, or if you specify expresn, the sum of the values of column where the value of expresn is distinct.
For graphs and OLE objects, you do not select the range when you call the function. The range has already been determined by the Rows setting on the Data property page (the Range property), and the aggregation function uses that range. Settings for Rows include:
- For the Graph or OLE presentation style, Rows is always All.
- For Graph controls, Rows can be All, Page, or Group.
- For OLE controls, Rows can be All, Current Row, Page, or Group. The available choices depend on the layer the control occupies.
NULL values are ignored and are not included in the calculation.
Not in validation rules or filter expressions You cannot use this or other aggregate functions in validation rules or filter expressions.
Using an aggregate function cancels the effect of setting Retrieve Rows As Needed in the painter. To do the aggregation, a DataWindow object or report always retrieves all rows.
http://cafe.naver.com/pentaeduclub.cafe
'파워빌더 > DataWindow' 카테고리의 다른 글
파워빌더.DataWindow - 컬럼 Auto Height (0) | 2017.01.26 |
---|---|
파워빌더.DataWindow - 합계 컬럼 (0) | 2017.01.26 |
파워빌더.DataWindow - 컬럼 내용에 따른 width 조절 (0) | 2017.01.26 |
파워빌더.DataWindow - 컬럼순서 변경 (0) | 2017.01.26 |
파워빌더.DataWindow - 컬럼 속성 변경 (0) | 2017.01.26 |