Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

객체 집합의 파생 속성

ObjectSet의 withProperties는 기존 객체와 함께 계산한 파생 속성을 반환합니다. 이 기능은 실험적이며 아직 일반 제공 기능이 아닙니다. derivedProperties의 키는 반환할 파생 속성 API 이름(DerivedPropertyApiName, 문자열)이고, 값은 계산식인 DerivedPropertyDefinition입니다.

계산식

각 계산식은 type으로 구분합니다. 아래에서 다른 계산식을 받는 필드는 DerivedPropertyDefinition을 재귀적으로 사용합니다.

type필드와 필수 여부계산
property필수 apiName: string객체 속성 참조
add선택적 properties: list<DerivedPropertyDefinition>숫자 값 두 개 이상을 더함
multiply선택적 properties: list<DerivedPropertyDefinition>숫자 값 두 개 이상을 곱함
absoluteValue필수 property: DerivedPropertyDefinition숫자의 절댓값
negate필수 property: DerivedPropertyDefinition숫자의 부호 반전
subtract필수 left, right왼쪽 숫자에서 오른쪽 숫자를 뺌
divide필수 left, right왼쪽 숫자를 오른쪽 숫자로 나눔
least선택적 properties: list<DerivedPropertyDefinition>숫자, 날짜 또는 시각 값 두 개 이상의 최솟값
greatest선택적 properties: list<DerivedPropertyDefinition>숫자, 날짜 또는 시각 값 두 개 이상의 최댓값
extract필수 property, part날짜 또는 시각에서 지정한 부분 추출
selection필수 objectSet, operationMethodObjectSet에서 선택한 속성에 연산 적용

subtract와 divide의 두 피연산자, extract.property는 모두 DerivedPropertyDefinition입니다. extract.part에는 DAYS, MONTHS, QUARTERS, YEARS 중 하나를 지정합니다. 컬렉션 필드의 선택 여부와 연산이 요구하는 피연산자 수를 구분합니다. 예를 들어 덧셈은 두 개 이상의 값을 더하는 연산입니다.

가상 Employee 유형의 salary와 bonus를 더하는 객체 집합 정의 예시입니다.

{
  "type": "withProperties",
  "objectSet": {"type": "base", "objectType": "Employee"},
  "derivedProperties": {
    "totalCompensation": {
      "type": "add",
      "properties": [
        {"type": "property", "apiName": "salary"},
        {"type": "property", "apiName": "bonus"}
      ]
    }
  }
}

선택 속성의 연산

selection.objectSet은 MethodObjectSet 정의이며 객체 집합 형식을 사용합니다. operation은 집계 또는 단일 속성 조회를 지정하는 구분자 객체입니다.

operation.type계산추가 필드
approximateDistinct서로 다른 속성값의 대략적인 개수필수 selectedPropertyApiName
exactDistinct서로 다른 속성값의 정확한 개수필수 selectedPropertyApiName
min최솟값필수 selectedPropertyApiName
max최댓값필수 selectedPropertyApiName
avg평균필수 selectedPropertyApiName
sum합계필수 selectedPropertyApiName
approximatePercentile근사 백분위수 값필수 selectedPropertyApiName, 필수 number approximatePercentile
get단일 속성값필수 selectedPropertyApiName
count전체 객체 수추가 필드 없음
collectList지정한 수까지 속성값 목록 수집필수 selectedPropertyApiName, 필수 integer limit
collectSet지정한 수까지 서로 다른 속성값 수집필수 selectedPropertyApiName, 필수 integer limit

selectedPropertyApiName은 문자열이며 Get Object Type이나 Ontology Manager에서 확인합니다. exactDistinct는 근사 집계보다 느릴 수 있습니다.

get의 대상 객체 집합이 링크의 MANY 쪽이고 결과 개수가 늘어날 수 있으면 예외가 발생합니다. 이 경우 값 목록을 반환하는 collectList 또는 collectSet을 사용합니다.

collectList와 collectSet의 limit은 필수이며 지원하는 최댓값은 100입니다. 속성값이 없는 객체는 제외하여 null이 아닌 값만 반환하고, 어떤 객체에도 해당 속성값이 없으면 빈 목록을 반환합니다.

반환 목록은 한도로 잘릴 수 있습니다. 전체 값 수는 해당 속성이 없는 객체를 제외한 같은 대상에 별도의 count 집계를 적용하여 확인합니다. 전체 서로 다른 값의 수는 별도의 approximateDistinct 또는 exactDistinct로 확인합니다. 수집 결과의 길이만으로 전체 개수를 판단하지 않습니다.