Non-persistent assignment · :=

🟢 2 of 2 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc2 (90ee9376) · 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["Non-persistent assignment · #58;#61;<br/>🟢2"]:::ok
    subgraph G_ds["Dataset"]
        direction LR
        v_ds["DS_r #58;#61; DS"]:::ok
    end
    subgraph G_sc["Scalar"]
        direction LR
        v_sc["SC_r #58;#61; sc"]:::ok
    end
    O --- G_ds
    O --- G_sc
    style G_ds fill:#f8f9fa,stroke:#495057,stroke-width:2px
    style G_sc fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 2 3
    click v_ds href "#form-ds"
    click v_sc href "#form-sc"
    

Types

Takes any scalar · Gives any type

Comes from: any operator that returns a value

Goes to: whatever takes its input's type

Forms

DS_r := DS 🟢 · any scalar → any type

Manual example 1 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1: a dataset assigned as it is to a non-persistent result.

Manual:

Non-persistent assignment, Example 1, output verbatim: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_r has the structure and the data points of DS_1.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Id_2Me_1Me_2
2013Belgium55
2013Denmark210
2013France312
2013Spain420
Expected DS_r
Id_1Id_2Me_1Me_2
2013Belgium55
2013Denmark210
2013France312
2013Spain420

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

Number measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Number measure: a decimal number, 1.5, a negative one, -2.25, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
11.5
2-2.25
3
Expected DS_r
Id_1Me_1
11.5
2-2.25
3

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

Integer measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on an Integer measure: a whole number, 10, a negative one, -3, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
110
2-3
3
Expected DS_r
Id_1Me_1
110
2-3
3

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

String measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a String measure: two strings, alpha and beta, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
1alpha
2beta
3
Expected DS_r
Id_1Me_1
1alpha
2beta
3

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

Boolean measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Boolean measure: the two boolean values, true and false, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
1true
2false
3
Expected DS_r
Id_1Me_1
1true
2false
3

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

Time measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Time measure: two intervals written in ISO 8601, 2020-01-01/2020-12-31 and 2021-01-01/2021-06-30, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
12020-01-01/2020-12-31
22021-01-01/2021-06-30
3
Expected DS_r
Id_1Me_1
12020-01-01/2020-12-31
22021-01-01/2021-06-30
3

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

Date measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Date measure: two dates, 2020-01-15 and 2021-12-31, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
12020-01-15
22021-12-31
3
Expected DS_r
Id_1Me_1
12020-01-15
22021-12-31
3

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

Time period measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Time_Period measure: two quarters, 2020Q1 and 2020Q2, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
12020Q1
22020Q2
3
Expected DS_r
Id_1Me_1
12020Q1
22020Q2
3

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

Duration measure 🟢 pandas ✅ · DuckDB ✅
Tests:

DS_r := DS_1 on a Duration measure: an annual and a monthly duration, A and M, and a null, which vtlengine loads, keeps and writes as they are.

Manual:

Non-persistent assignment: “The result re is a non-persistent Data Set that has the same data structure as the Operand.”

Expected:

DS_1 as it is: every value comes back as it went in, the null included, and the structure keeps Id_1 not nullable and Me_1 nullable.

script.vtl
DS_r := DS_1;
Input DS_1
Id_1Me_1
1A
2M
3
Expected DS_r
Id_1Me_1
1A
2M
3

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

SC_r := sc 🟢 · any scalar → any type

Integer literal 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_r := 3: a scalar assigned to a non-persistent result.

Manual:

Non-persistent assignment: “If the Operand op is a scalar value, the result Data Set has no Components and contains only such a scalar value. For example, income := 3 assigns the value 3 to the non-persistent Data Set named income.”

Expected:

SC_r = 3, an Integer.

script.vtl
SC_r := 3;
Expected scalars

Name

Type

Value

SC_r

Integer

"3"

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

Input value 🟢 pandas ✅ · DuckDB ✅
Tests:

SC_r := SC_1 with the input scalar SC_1 = 3: a scalar read from the input, assigned to a non-persistent result.

Manual:

Non-persistent assignment: “If the Operand op is a scalar value, the result Data Set has no Components and contains only such a scalar value. For example, income := 3 assigns the value 3 to the non-persistent Data Set named income.”

Expected:

SC_r = 3, an Integer: the value of SC_1.

script.vtl
SC_r := SC_1;
Input scalars
SC_1
3
Expected scalars

Name

Type

Value

SC_r

Integer

"3"

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