GetKeyValue

myNamespaceModule.GetKeyValue(keyName[, isUserSpecific][, timeoutInSeconds]);

myNamespaceModuleThe name of the namespace-specific module instance
keyNameA STRING naming the key; may not be an empty string; REQUIRED
isUserSpecificIf TRUE, the system will look only for private keys; if FALSE then the system will look for global keys; OPTIONAL, defaults to FALSE
timeoutInSecondsThe 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);  // FALSE

See Also: GetKeyValueResponseRec