Skip to main content
Skip table of contents

Storing to and Retrieving Data from Memory

You can use the Memory adapter to store data to and retrieve data from memory.

Storing Data to Memory

Using the store operation from the Memory adapter, you can store data. Provide the following parameters:

Name

Type

Direction

Description

key

String

in

Set a key that can be used to access the stored value with the retrieve operation.

value

Any

in

Provide the data that should be stored to the memory.

If an element with the given key already exists in memory, it will be overwritten by the Memory Adapter. In this case, no error is thrown, parameter oldValue returns the value that got overwritten.

Name

Type

Direction

Description

oldValue

Any

out

If the provided key is already present in the memory, it gets overwritten. In this case, oldValue returns the previous value. If no old value is present, oldValue is NULL.

If you want to store not only single data items to memory but multiple values, we recommend using the Memory adapter with a map. This is much faster as you can store all values with one store operation call, and you can still access single values using retrieve with hasMapKey.

Retrieving Data From Memory

Using the retrieve operation from the Memory adapter, you can store data. Provide the following parameters:

Name

Type

Direction

Description

key

String

in

Provide the key of the value that has been stored to memory with store. If no value with this key can be found, the Memory adapter throws error MEMADSM/9.

If no data with the given key can be found, the Memory adapter throws an error. In all other cases, value contains the data.

Name

Type

Direction

Description

value

Any

out

Returns the stored value.

Related Error Codes

Find a list of all persistent state error codes on System Errors of the Memory Adapter.

Error Code

Description

MEMADSM/9

The message is not stored here.

MemoryAdapter_GuessingGame_Example

Click here to download a simple example model that shows the usage of the Memory adapter in Scheer PAS Designer.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.