Share data between simulations
You can work with resources to share data between different running simulations. Let's say you always need an access token as the first step in your simulations. You can store this token in a resource and reference it in your simulation. This way, you can manage tokens in one place and not in all simulations that need the token.
How does is work?
-
First, you need to create a resource that defines how to access a data source.
-
Then you reference this resource with the access information to get the data from your data source.
You must store simulations that share data in the same workspace folder.
Create a resource to access data
Create a resource that defines how your simulations access data. For example, you define the file path and the access data to a database in the resource. If this data changes, you only need to update the resource. All simulations that reference the resource don't need to be updated.
To create the resource, only the name property is mandatory. Optionally, you can use additional resource properties to define the structure of your data source.

Here's an example of a resource definition:
-
The name of the resource is user.
-
The referenced data source is an sql table where the entries are separated by commas.
schema: SimV1
name: Customer
resources:
- name: user
type: Table
file: ../../resources/db.sqlite
listEntrySeparator: ","
Reference to a resource with access data
To use data from a data source, you must reference the resource with the appropriate properties to access it.
Define your simulation as follows:
-
Enter the resource property in the appropriate step to indicate that a data source is being accessed.
-
Specify whether to read, or modify data from the data source. Valid properties are: delete, insert, read, and update.
-
Optionally, you can specify one of the resource rule properties to further specify the data to use.
-
Alternatively, you can use the FROM expression to access data from a resource.

Here's an example of accessing data from a data source:
-
The name of the simulation is read customer and it contains a service called read.
-
The first step of the service reads data from the resource called user. To access this data later, we give it the name list.
-
The second step inserts the values from the read step by using the buffer syntax.
schema: SimV1
name: read customer
services:
- name: read
steps:
- resource:
read:
- ref: user
name: list
- insert:
- value: '{B[list]}'