Variable Levels in FileMaker
You may have seen, that FileMaker provides 3 level of variables. From global file variables with $$ to script variables with one $ and then the local variables within a Let or While statement. For most use cases this is enough, but if you need more, we can help:
Via MBS FileMaker Plugin you can use our Variables functions to have global variables within the FileMaker process. e.g. set in one file and retrieve in another file. This is great for multi file solutions storing global values in memory. While they are not shown in the data viewer, you can use FM.VariableNames to query the list of variables.
The SharedMemory functions goes a step further and lets you store text blocks in RAM outside the FileMaker process. This allows you to store a value, which stays in memory, even if FileMaker Pro is quit. If your solution runs again later, you can pick up the value.
For FileMaker Server the plugin can run in three different processes: FileMaker Script Engine (FMSE), the WebDirect process (cwpc) and the Data API process (wip). Each of the processes has their own set of plugin variables, but can access the same shared memory. So if you like to pass data between them, put it in a shared memory with SharedMemory.SetValue. By using an UUID as name, you can make it unique and pass this identifier to the other process to read the data back. If needed, use Mutex functions to synchronize access.
|Calculation||No prefix needed. |
¢, ~ or _ is often used.
|Within Let or While statement.||Store temporary results, loop counters and prepare result.||When While or Let ends.||Within calculation engine.|
|Script||$ prefix||Within a single script||Normal Variables||When script ends.||Within script engine.|
|File||$$ prefix||In all scripts and calculations within a specific file.||Values you need to share between scripts.||When you close the file.||FileMaker app memory.|
|Plugin Variable||Any name you like||Global in the process||Share values between different files in the same process, e.g. FileMaker Pro.||When you quit FileMaker. Or for server processes restart them or the whole server.||FileMaker app memory.|
|Shared Memory||Any name you like||All processes on the computer.||Share values between different processes, e.g. between PSoS scripts and WebDirect scripts.||When you restart computer.||System memory outside FileMaker app.|
Enjoy our plugin based variables and the shared memory functions. Please don't hesitate to contact us with your questions.