- 만들기
- 스크립트 구문 및 차트 함수
- 스크립트 및 차트 표현식의 함수
- 인터 레코드 함수
- Exists - 스크립트 함수
Exists - 스크립트 함수
Exists()는 특정 필드 값이 데이터 로드 스크립트의 필드에 이미 로드되었는지 여부를 판단합니다. 이 함수는
Syntax:
Exists(field_name [, expr])
Return data type: 부울
Arguments:
인수 | 설명 |
---|---|
|
검색할 필드 이름에 대해 평가되는 이름 또는 문자열 표현식입니다. 이 필드는 스크립트에 의해 현재까지 로드된 데이터에 존재해야 합니다. |
|
field-name에 지정된 필드에서 검색할 필드 값으로 평가되는 표현식입니다. 생략하면 지정된 필드의 현재 레코드 값이 사용됩니다. |
예 | 결과 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Exists (Employee) |
현재 레코드의 Employee 필드 값이 이전에 읽은 레코드 중 해당 필드가 포함된 레코드에 이미 존재할 경우 -1( |
||||||||||
Exists(Employee, 'Bill') |
필드 값 'Bill'이 Employee 필드의 현재 내용에서 발견되는 경우 -1( Exists (Employee, Employee) 및 Exists (Employee) 문은 동등합니다. |
||||||||||
Employees: LOAD * inline [ Employee|ID|Salary Bill|001|20000 John|002|30000 Steve|003|35000 ] (delimiter is '|');
Citizens: Load * inline [ Name|Address Bill|New York Mary|London Steve|Chicago Lucy|Paris John|Miami ] (delimiter is '|');
EmployeeAddresses: Load Name as Employee, Address Resident Citizens where Exists (Employee, Name);
Drop Tables Employees, Citizens; |
|
||||||||||
NonEmployee: Load Name as Employee, Address Resident Citizens where not Exists (Employee, Name); |
|
||||||||||
|
데이터 사용 예:
Employees:
LOAD * inline [
Employee|ID|Salary
Bill|001|20000
John|002|30000
Steve|003|35000
] (delimiter is '|');
Citizens:
Load * inline [
Name|Address
Bill|New York
Mary|London
Steve|Chicago
Lucy|Paris
John|Miami
] (delimiter is '|');
EmployeeAddresses:
Load Name as Employee, Address Resident Citizens where Exists (Employee, Name);
Drop Tables Employees, Citizens;