Less than or equal to · <=

🟢 7 of 7 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc3 (9e1c81a6) · pandas 2.3.3 · DuckDB 1.5.5
🟢 all ok🟡 partially implemented🛡️ refused with an error🔴 not implemented or crash🔵 engines differ ✅ match · ❌ wrong result · 🛡 guarded error (code) · 💥 crash · 📌 team decision
Dataset formsComponent formsScalar forms
        ---
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["Less than or equal to · #60;=<br/>🟢7"]:::ok
    subgraph G_ds["Dataset"]
        direction LR
        v_ds_ds["DS #60;= DS"]:::ok
        v_ds_sc["DS #60;= sc"]:::ok
        v_sc_ds["sc #60;= DS"]:::ok
    end
    subgraph G_comp["Component"]
        direction LR
        v_comp_comp["comp #60;= comp"]:::ok
        v_comp_sc["comp #60;= sc"]:::ok
        v_sc_comp["sc #60;= comp"]:::ok
    end
    subgraph G_sc["Scalar"]
        direction LR
        v_sc_sc["sc #60;= sc"]:::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_ds href "#form-ds-ds"
    click v_ds_sc href "#form-ds-sc"
    click v_sc_ds href "#form-sc-ds"
    click v_comp_comp href "#form-comp-comp"
    click v_comp_sc href "#form-comp-sc"
    click v_sc_comp href "#form-sc-comp"
    click v_sc_sc href "#form-sc-sc"
    

Types

Takes any scalar · Gives boolean

Viral attributes: combined with the propagation rules → Viral propagation

Comes from: any operator that returns a value

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 <= DS 🟢 · any scalar → boolean

Reordered data points and null 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 <= DS_2, where DS_2 lists its data points in another order than DS_1 and has a null measure.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” The data points that couple are those “which have the same values as for the common Identifiers” (Typical behaviours).

Expected:

bool_var, the page’s measure for a data set result, is true, true, false and null for ids 1 to 4: 2 <= 2 is true, as <= includes the equal value; DS_2 lists id 3 first, but data points pair by identifier, not by position, and id 4 faces a null. 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).

script.vtl
DS_r := DS_1 <= DS_2;
Input DS_1
Id_1Me_1
11
22
33
44
Input DS_2
Id_1Me_1
31
13
4
22
Expected DS_r
Id_1bool_var
1true
2true
3false
4

Files: script.vtl · input/DS_1.csv · input/DS_1.json · input/DS_2.csv · input/DS_2.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

DS <= sc 🟢 · any scalar → boolean

Equal value and null measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_1 <= 2: every measure value of DS_1 against a scalar, where one value equals it and one is null.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” 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).

Expected:

bool_var, the page’s measure for a data set result, is true, true, false and null for ids 1 to 4: 2 <= 2 is true, as <= includes the equal value, and the null measure gives null.

script.vtl
DS_r := DS_1 <= 2;
Input DS_1
Id_1Me_1
11
22
33
4
Expected DS_r
Id_1bool_var
1true
2true
3false
4

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

sc <= DS 🟢 · any scalar → boolean

Scalar first and null measure 🟢 pandas ✅ · DuckDB ✅
Tests:

2 <= DS_1, a scalar as the left operand, where one measure value equals it and one is null.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” 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).

Expected:

bool_var, the page’s measure for a data set result, is false, true, true and null for ids 1 to 4: 2 <= 2 is true, as <= includes the equal value, and the null measure gives null.

script.vtl
DS_r := 2 <= DS_1;
Input DS_1
Id_1Me_1
11
22
33
4
Expected DS_r
Id_1bool_var
1false
2true
3true
4

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

comp <= comp 🟢 · any scalar → boolean

Two measures and null 🟢 pandas ✅ · DuckDB ✅
Tests:

Me_1 <= Me_2 inside calc: two measures of one data set, equal in one data point and with a null Me_2 in another.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” 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).

Expected:

Me_3 is a new boolean measure: true, true, false and null for ids 1 to 4; 2 <= 2 is true, as <= includes the equal value, and id 4 compares 4 with a null; Me_1 and Me_2 are kept.

script.vtl
DS_r := DS_1 [ calc Me_3 := Me_1 <= Me_2 ];
Input DS_1
Id_1Me_1Me_2
113
222
331
44
Expected DS_r
Id_1Me_1Me_2Me_3
113true
222true
331false
44

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

comp <= sc 🟢 · any scalar → boolean

Equal value and null measure 🟢 pandas ✅ · DuckDB ✅
Tests:

Me_1 <= 2 inside calc: a measure against a scalar, where one value equals it and one is null.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” 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).

Expected:

Me_2 is a new boolean measure: true, true, false and null for ids 1 to 4; 2 <= 2 is true, as <= includes the equal value, and the null measure gives null; Me_1 is kept.

script.vtl
DS_r := DS_1 [ calc Me_2 := Me_1 <= 2 ];
Input DS_1
Id_1Me_1
11
22
33
4
Expected DS_r
Id_1Me_1Me_2
11true
22true
33false
4

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

sc <= comp 🟢 · any scalar → boolean

Scalar first and null measure 🟢 pandas ✅ · DuckDB ✅
Tests:

2 <= Me_1 inside calc, a scalar as the left operand, where one measure value equals it and one is null.

Manual:

Less than: “The operator <= returns true if left is smaller than or equal to right, false otherwise.” 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).

Expected:

Me_2 is a new boolean measure: false, true, true and null for ids 1 to 4; 2 <= 2 is true, as <= includes the equal value, and the null measure gives null; Me_1 is kept.

script.vtl
DS_r := DS_1 [ calc Me_2 := 2 <= Me_1 ];
Input DS_1
Id_1Me_1
11
22
33
4
Expected DS_r
Id_1Me_1Me_2
11false
22true
33true
4

Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗

sc <= sc 🟢 · any scalar → boolean

Equal numbers 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_1 <= SC_2 with SC_1 = 5 and SC_2 = 5: two equal numbers.

Manual:

Less than, semantics for scalar operations: “5 <= 5 gives true”.

Expected:

SC_r = true, a Boolean: 5 is equal to 5, and <= includes the equal value.

script.vtl
SC_r := SC_1 <= SC_2;
Input scalars
SC_1SC_2
55
Expected scalars

Name

Type

Value

SC_r

Boolean

true

Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗