Replacement values
Use the TRY dynamic expression to enter a replacement value for a step property if a specific dynamic value can't be found. For example, if you want to read a buffered value that doesn't exist and don't want an exception, use the replacement value.
Use the value {TRY[<dynamic expression>][<replacement>]} with the Insert step property to define a replacement value.
In this example, we read data from a resource named movies using the FROM expression.
The insert step tries to insert a value from the movies resource. Specifically, it reads the value of the title column from the row whose id matches the buffered id. If it doesn't find a value, the replacement value movie not found is used.
schema: SimV1
name: Test01
resources:
- name: movies
file: movies.csv
services:
- name: movies
steps:
- trigger:
- uri: /movies/*
buffer:
- type: Path
value: '/movies/{xb[id]}'
- insert:
- value: '{TRY[{FROM[movies][title][id = "{B[id]}"]}][movie not found]'