CREATE_OR_LOAD_INSTANCE

Attempts to load an instance from a persistence store. If no persistence provider is configured, a new instance will be created and the values in the provided data collection will be used to initialize the new instance.

Usage

CREATE_OR_LOAD_INSTANCE(modelName, twinId, dataCollectionName)

Parameters

modelName

String

Name of the model to create an instance for.

twinId

String

The instance identifier of the twin to create.

dataCollectionName

String

The data collection containing values to initialize the new instance if needed.

Returns

Action

Examples

CREATE_OR_LOAD_INSTANCE(‘MyModel’, ‘12345’, ‘myData’)

Creates a new instance of the model ‘MyModel’ with the identifier ‘12345’.

Remarks

  1. This method is only available in simulation rules.

  2. If no persistence provider is configured or no instance with the provided ID exists, a new instance will be created and initialized with the values present in the data collection. You can use override functions to specify new values.