DBWGetValueFromMemory

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > PDMSystem >

DBWGetValueFromMemory

Description

This function allows to retrieve from memory a string value linked to a key string as in a hashtable.

Syntax

Function DBWGetValueFromMemory(memoryKey)

Parameters

memoryKey

memory key value to read from

Remarks

The values are serialized at each assignment and are therefore available across sessions and also after rebooting the workstation.
If you want to avoid reading values from a previous session, make sure that the first operation associated with memory values in a new session of DBWorks is of type SET and not of type GET (the value being set is not relevant to this goal).

See also

DBWSetValueInMemory Sub

Example

This example show the persistency of the set value even when script is expired.
The variable is set in file named first.vbs; then is read by the script named second.vbs

First.vbs

Sub main()
 dbwinit(TRUE)
 msgbox "This is the SETTING script"
 res=DBWInputBox ( "Enter a value to write in memory" , input_string )
 if res=TRUE then DBWSetValueInMemory "mykey", input_string
End Sub

Second.vbs

Sub main()
 dbwinit(TRUE)
 msgbox "This is the CALLING script"
 myvar=DBWGetValueFromMemory("mykey")
 msgbox myvar
End Sub