Element of · in
---
config:
flowchart:
useMaxWidth: false
---
flowchart TB
classDef ok fill:#d4edda,stroke:#28a745,color:#000
classDef partial fill:#fff3cd,stroke:#ffc107,color:#000
classDef refused fill:#d4edda,stroke:#28a745,stroke-width:3px,stroke-dasharray: 2 2,color:#000
classDef missing fill:#f8d7da,stroke:#dc3545,color:#000
classDef diverge fill:#cce5ff,stroke:#007bff,color:#000
classDef block fill:#2b3a4a,stroke:#2b3a4a,color:#fff,font-weight:bold
classDef ext fill:#fff,stroke:#666,color:#000,stroke-dasharray: 5 5
O["Element of · in<br/>🟢5"]:::ok
subgraph G_ds["Dataset"]
direction LR
v_ds_set["DS in set"]:::ok
v_ds_value_domain["DS in value domain"]:::ok
end
subgraph G_comp["Component"]
direction LR
v_comp_set["comp in set"]:::ok
v_comp_value_domain["comp in value domain"]:::ok
end
subgraph G_sc["Scalar"]
direction LR
v_sc_set["sc in set"]:::ok
end
O --- G_ds
O --- G_comp
O --- G_sc
style G_ds fill:#f8f9fa,stroke:#495057,stroke-width:2px
style G_comp fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 8 5
style G_sc fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 2 3
click v_ds_set href "#form-ds-set"
click v_comp_set href "#form-comp-set"
click v_sc_set href "#form-sc-set"
click v_ds_value_domain href "#form-ds-value-domain"
click v_comp_value_domain href "#form-comp-value-domain"
Types
Takes set, value domain, any scalar · Gives boolean
Comes from: any operator that returns a value
Comes from · set, value domain: none
Goes to · boolean — 27 operators in 8 blocks 🟢27
General purpose operators (1) 🟢1
Join operators (4) 🟢4
Boolean operators (4) 🟢4
Aggregate and Analytic operators (10) 🟢10
Data validation operators (1) 🟢1
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (3) 🟢3
Goes to · operators that take any scalar — 37 operators in 8 blocks 🟢37
General purpose operators (6) 🟢6
Comparison operators (10) 🟢10
Set operators (4) 🟢4
Aggregate and Analytic operators (7) 🟢7
Data validation operators (1) 🟢1
Conditional operators (1) 🟢1
Clause operators (7) 🟢7
Definitions (VTL-DL) (1) 🟢1
Forms
DS in set 🟢 · any scalar, set → boolean
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
DS_1 in { 0, 3, 6, 12 }: every measure value ofDS_1against a set literal.- Manual:
Element of, Example 1, output verbatim: “The in operator returns true if op belongs to the collection, false otherwise.”
- Expected:
bool_varis true for BS (0) and MO (6), and false for GZ, SQ, FJ and CQ (4, 9, 7 and 2).
DS_r := DS_1 in { 0, 3, 6, 12 };
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2012 | BS | 0 |
| 2012 | GZ | 4 |
| 2012 | SQ | 9 |
| 2012 | MO | 6 |
| 2012 | FJ | 7 |
| 2012 | CQ | 2 |
| Id_1 | Id_2 | bool_var |
|---|---|---|
| 2012 | BS | true |
| 2012 | GZ | false |
| 2012 | SQ | false |
| 2012 | MO | true |
| 2012 | FJ | false |
| 2012 | CQ | false |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
DS in value domain 🟢 · any scalar, value domain → boolean
Manual example 3 🟢 pandas ✅ · DuckDB ✅
- Tests:
DS_1#Id_2 in myGeoValueDomain: the identifierId_2, taken as a measure by the membership operator, against a value domain.- Manual:
Element of, Example 3, output verbatim: “The in operator returns true if op belongs to the collection, false otherwise.” The page defines the Value Domain
myGeoValueDomain(string) in the text before its examples, not in their files, as{"AF", "BS", "FJ", "GA", "KH", "MO", "PK", "QA", "UG"}; it is passed torunasvalue_domains/myGeoValueDomain.json.- Expected:
bool_varis true for BS, MO and FJ, which are elements of the value domain, and false for GZ, SQ and CQ, which are not.
DS_r := DS_1#Id_2 in myGeoValueDomain;
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2012 | BS | 0 |
| 2012 | GZ | 4 |
| 2012 | SQ | 9 |
| 2012 | MO | 6 |
| 2012 | FJ | 7 |
| 2012 | CQ | 2 |
| Id_1 | Id_2 | bool_var |
|---|---|---|
| 2012 | BS | true |
| 2012 | GZ | false |
| 2012 | SQ | false |
| 2012 | MO | true |
| 2012 | FJ | true |
| 2012 | CQ | false |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/myGeoValueDomain.json · example page ↗
comp in set 🟢 · any scalar, set → boolean
Manual example 2 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 in { 0, 3, 6, 12 }insidecalc, where the new measureMe_2takes the result.- Manual:
Element of, Example 2, output verbatim: “The in operator returns true if op belongs to the collection, false otherwise.”
- Expected:
Me_2is true for BS and MO, and false for GZ, SQ, FJ and CQ;Me_1is kept.
DS_r := DS_1 [ calc Me_2:= Me_1 in { 0, 3, 6, 12 } ];
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2012 | BS | 0 |
| 2012 | GZ | 4 |
| 2012 | SQ | 9 |
| 2012 | MO | 6 |
| 2012 | FJ | 7 |
| 2012 | CQ | 2 |
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 2012 | BS | 0 | true |
| 2012 | GZ | 4 | false |
| 2012 | SQ | 9 | false |
| 2012 | MO | 6 | true |
| 2012 | FJ | 7 | false |
| 2012 | CQ | 2 | false |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
comp in value domain 🟢 · any scalar, value domain → boolean
Members and null operand 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 in myGeoValueDomaininsidecalc: the elementsAFandUG(the first and the last of the value domain), the non-elementCQand a null.- Manual:
Element of: “The in operator returns true if op belongs to the collection, false otherwise.” The page defines the Value Domain
myGeoValueDomain(string) in the text before its examples, as{"AF", "BS", "FJ", "GA", "KH", "MO", "PK", "QA", "UG"}; it is passed torunasvalue_domains/myGeoValueDomain.json.- Expected:
Me_2is a new boolean measure: true for AF, false for CQ, true for UG and null for the null;Me_1is kept. A null operand gives a null result: “Whenever a null value is involved in a comparison (>, <, >=, <=, in, not in, between) the result of the comparison is null” (User Manual).
DS_r := DS_1 [ calc Me_2 := Me_1 in myGeoValueDomain ];
| Id_1 | Me_1 |
|---|---|
| 1 | AF |
| 2 | CQ |
| 3 | UG |
| 4 |
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | AF | true |
| 2 | CQ | false |
| 3 | UG | true |
| 4 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/myGeoValueDomain.json · example page ↗
sc in set 🟢 · any scalar, set → boolean
Member of a set 🟢 pandas ✅ · DuckDB ✅
- Tests:
SC_1 in { 1, 2, 3 }withSC_1= 1: a scalar that is an element of a set literal.- Manual:
Element of, semantics for scalar operations: “
1 in { 1, 2, 3 }returnstrue”.- Expected:
SC_r = true, a Boolean: 1 is an element of the set.
SC_r := SC_1 in { 1, 2, 3 };
| SC_1 |
|---|
| 1 |
Name |
Type |
Value |
|---|---|---|
|
Boolean |
|
Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗