Exists
(Employee)
|
現在のレコード内の項目 Employeeの値が、その項目を含む読み取り済みのレコード内にすでに存在してれば、-1 (True) を返します。
|
Exists(Employee,
'Bill')
|
項目値 'Bill'が項目 Employee の現在のコンテンツに含まれていれば、-1 (True) を返します。
ステートメント 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;
|
この例では、データ モデルの EmployeeAddressesと呼ばれるテーブルがロードされ、このテーブルは Employee 軸と Address 軸を使用してテーブル チャートとして表示できます。
where節:where Exists (Employee, Name) は、テーブル Citizens からEmployees にも存在する名前のみを新しいテーブルにロードすることを意味します。Dropステートメントは、一時的なテーブル Employees と Citizens を混乱を避けるために削除します。
|
Employee |
Address |
Bill |
New York |
John |
Miami |
Steve |
Chicago |
|
|
where not Existsを使用してテーブルEmployeeAddressesを作成する、前の例のサンプル データのステートメントを次で置き換えます。
NonEmployee:
Load Name as Employee, Address Resident Citizens where not Exists (Employee, Name);
|
where節は not を含みます: where not Exists (Employee, Name) は、テーブル Citizens から Employees にも存在する名前のみを新しいテーブルにロードすることを意味します。
|
Employee |
Address |
Mary |
London |
Lucy |
Paris |
|