Kapitel 13/Tutorial.md aktualisiert
This commit is contained in:
@@ -374,67 +374,56 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
||||
{"file_exists":true,"non_empty":false,"vods":[]}
|
||||
{"file_exists":true,"non_empty":true,"vods":["123456789","987654321"]}
|
||||
```
|
||||
### 5. Set Node – Felder übernehmen
|
||||
5. Set Node – Felder übernehmen
|
||||
|
||||
# Set Node – Felder übernehmen
|
||||
# Set Node – Felder übernehmen
|
||||
|
||||
file_exists →
|
||||
```json
|
||||
{{ JSON.parse($json.stdout).file_exists }}
|
||||
```
|
||||
non_empty →
|
||||
```json
|
||||
{{ JSON.parse($json.stdout).non_empty }}
|
||||
```
|
||||
vods →
|
||||
```json
|
||||
{{ JSON.parse($json.stdout).vods }}
|
||||
```
|
||||
file_exists → ```json {{ JSON.parse($json.stdout).file_exists }} ```
|
||||
non_empty → ```json {{ JSON.parse($json.stdout).non_empty }} ```
|
||||
vods → ```json {{ JSON.parse($json.stdout).vods }} ```
|
||||
|
||||
# WICHTIG
|
||||
- Stelle die Felder auf den Typ Array bzw. Boolean um.
|
||||
- Aktiviere die Option: Add Option → Ignore Type Conversion Errors → einschalten.
|
||||
|
||||
# WICHTIG
|
||||
- Stelle die Felder auf den Typ Array bzw. Boolean um.
|
||||
- Aktiviere die Option: Add Option → Ignore Type Conversion Errors → einschalten.
|
||||
|
||||
|
||||
|
||||
### 6. State ermitteln (Set-Node – EIN Feld)
|
||||
# State ermitteln
|
||||
state →
|
||||
```json
|
||||
{{ $json.file_exists === false
|
||||
? 'CREATE_AND_DOWNLOAD'
|
||||
: ($json.non_empty === false
|
||||
? 'APPEND_AND_DOWNLOAD'
|
||||
: 'NEED_CHECK') }}
|
||||
```
|
||||
# WICHTIG
|
||||
- Aktiviere die Option: Include Other Input Fields → ALL.
|
||||
6. State ermitteln (Set-Node – EIN Feld)
|
||||
|
||||
# State ermitteln
|
||||
state →
|
||||
```json
|
||||
{{ $json.file_exists === false
|
||||
? 'CREATE_AND_DOWNLOAD'
|
||||
: ($json.non_empty === false
|
||||
? 'APPEND_AND_DOWNLOAD'
|
||||
: 'NEED_CHECK') }}
|
||||
```
|
||||
# WICHTIG
|
||||
- Aktiviere die Option: Include Other Input Fields → ALL.
|
||||
|
||||
7. Switch-Node – drei klare Wege
|
||||
|
||||
Switch → Property Name: ```json {{ $json.state }} ```
|
||||
In diesem Schritt legen wir die Entscheidungspfade in einem **Switch-Node** an. Dafür werden drei Regeln hinzugefügt, die jeweils einen klar benannten Output erzeugen.
|
||||
|
||||
Cases:
|
||||
|
||||
CREATE_AND_DOWNLOAD → Datei anlegen und VOD sofort downloaden.
|
||||
```git
|
||||
# Switch-Node Einstellungen
|
||||
Mode: Rules
|
||||
Property: {{ $json.state_expression }}
|
||||
|
||||
APPEND_AND_DOWNLOAD → Datei ist leer → VOD-ID direkt eintragen und downloaden.
|
||||
# Regeln
|
||||
1. Regel:
|
||||
- Bedingung: {{ $json.state_expression }} is equal to CREATE_AND_DOWNLOAD
|
||||
- Rename Output: ON
|
||||
- Output Name: CREATE_AND_DOWNLOAD
|
||||
|
||||
NEED_CHECK → Datei existiert und ist nicht leer → hier prüfen, ob die aktuelle VOD-ID schon enthalten ist.
|
||||
2. Regel:
|
||||
- Bedingung: {{ $json.state_expression }} is equal to APPEND_AND_DOWNLOAD
|
||||
- Rename Output: ON
|
||||
- Output Name: APPEND_AND_DOWNLOAD
|
||||
|
||||
Branch NEED_CHECK
|
||||
|
||||
Set (kurz)
|
||||
|
||||
currentVod → ```json {{ $json.vodId ?? $json.data[0].id }} ```
|
||||
|
||||
contains_vod → ```json {{ Array.isArray($json.vods) && $json.vods.includes($json.currentVod) }} ```
|
||||
|
||||
IF Node (einmalig in diesem Branch)
|
||||
|
||||
Bedingung: ```json {{ $json.contains_vod === true }} ```
|
||||
|
||||
True: Pfad beenden (VOD bereits verarbeitet)
|
||||
|
||||
False: Download & Analyse starten, danach ID anhängen
|
||||
3. Regel:
|
||||
- Bedingung: {{ $json.state_expression }} is equal to NEED_CHECK
|
||||
- Rename Output: ON
|
||||
- Output Name: NEED_CHECK
|
||||
```
|
||||
Damit hat der Switch-Node drei klar benannte Ausgänge, die die weitere Logik steuern.
|
||||
Reference in New Issue
Block a user