SetKeyValue

myNamespaceModule.SetKeyValue(keyName, keyValue[, isUserSpecific][, timeoutInSeconds]);

myNamespaceModuleThe name of the namespace-specific module instance
keyNameA STRING naming the key; may not be an empty string; REQUIRED
keyValueA STRING representing the value to store for the key; may be an empty string; REQUIRED
isUserSpecificIf TRUE, this key will be visible only to the user indicated by the (username, userPW) arguments provided when the module was defined; if FALSE, the key will be global and visible to all users; 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 SetKeyValueResponseRec RECORD

The SetKeyValue function sets a value for a key within a namespace. If the key already exists then its value is overridden. The namespace will be created if it has not already been defined.

Example:

IMPORT STD;

myStore := STD.System.Store();
myNamespace := myStore.WithNamespace('Config', 'MyStore');

// Set a global key
result1 := myNamespace.SetKeyValue('ApiEndpoint', 'https://api.example.com/v1');
OUTPUT(result1.succeeded);

// Set a user-specific key
result2 := myNamespace.SetKeyValue('UserPreference', 'darkmode', TRUE);
OUTPUT(result2.succeeded);

// Update an existing key
result3 := myNamespace.SetKeyValue('ApiEndpoint', 'https://api.example.com/v2');
OUTPUT(result3.succeeded);

See Also: SetKeyValueResponseRec