Rsource data values
You can work with resources to share data at runtime between different running simulations.
To use data from a resource, specify the syntax {FROM[resource name][column][condition]} with the step properties Insert, Verify, or Trigger.
|
Parameter |
Description |
|---|---|
|
Resource name |
Specify the name of the resource that contains the data you want to use. |
|
Column |
Specify the column in which you want to search. |
|
Condition |
Define a SQL WHERE clause to narrow the value you want to use. |
In this example, we read data from a resource named movies, which is a CSV table of movies.
-
The trigger step waits for a message with a uri property containing the value movies. If an incoming message meets this condition, API simulation uses an XBuffer to save the value of the property id.
-
The next step inserts a value from the movies resource. Specifically, it reads the value of the title column from the row whose id matches the buffered id.
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: '{FROM[movies][title][id = "{B[id]}"]}'