myNamespaceModule.GetKeyValue(keyName[, isUserSpecific][, timeoutInSeconds]);
| myNamespaceModule | The name of the namespace-specific module instance |
| keyName | A STRING naming the key; may not be an empty string; REQUIRED |
| isUserSpecific | If TRUE, the system will look only for private keys; if FALSE then the system will look for global keys; OPTIONAL, defaults to FALSE |
| timeoutInSeconds | The number of seconds to wait for the underlying SOAPCALL to complete; set to zero to wait forever; OPTIONAL, defaults to zero |
| Return: | A GetKeyValueResponseRec RECORD. Note that the record will have was_found set to TRUE or FALSE, depending on whether the key was actually found in the key/value store. |
The GetKeyValue function gets a previously-set value for a key within a namespace.
Example:
IMPORT STD;
myStore := STD.System.Store();
myNamespace := myStore.WithNamespace('Config', 'MyStore');
// Get a global key
result1 := myNamespace.GetKeyValue('ApiEndpoint');
OUTPUT(result1.was_found);
OUTPUT(result1.value);
// Get a user-specific key
result2 := myNamespace.GetKeyValue('UserPreference', TRUE);
IF(result2.was_found,
OUTPUT(result2.value),
OUTPUT('Key not found'));
// Check for non-existent key
result3 := myNamespace.GetKeyValue('NonExistentKey');
OUTPUT(result3.was_found); // FALSESee Also: GetKeyValueResponseRec