Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method

Set

ModuleStorage
LibraryCore
Action


Excerpt
Set or change the value of the named persistent storage table.


Parameters

Name (string): The name of the persistent storage table. Case is not significant.

Value (

string

table): The table contents to be written to, or overwritten in, the named persistent storage table.

Append (bool; optional, default false): Whether to append to whatever is already in the table (true) or overwrite it (false). Available from v5.3 onwards.

It is not an error to append if the table does not already exist; in this situation the parameter's value is irrelevent.

Warning
There is no check that the schema of the appended rows is the same as that of those already there.

MaxRowCount (int; optional, default 1000): When appending, limit the table to this maximum number of rows. Available from v5.3 onwards.

The range is 1 to the SelectRowsLimit configuration value (100000 by default). This should be specified only if Append is true. There is no limit when overwriting.

Return valuesName (string): The name of the new or updated persistent storage table.
Examples

A simple example.

Code Block
@table = Agent.GetSummary();
Storage.Set(Name: "Agent_Summary.Oct2018", Value: @table);

The method overwrites whatever was previously in the table. If you want to accumulate data by appending, this shows an example these show examples of a task that would be run periodically to record who is logged on at that time. It They also returns return the accumulated data.

Code Block
titleVersion (a) not using Append, up to v5.2
@loggedOnUsers = Users.GetLoggedOnUsers();
@newEntries = SELECT *, datetime("now") AS Timestamp FROM @loggedOnUsers;
@storageName = SELECT "LoggedInAudit" AS Name;
@found = Storage.Check(Name:@storageName);
IF (@found)
    @currentEntries = Storage.Get(Name:@storageName);
    @newEntries = @currentEntries + @newEntries;
ENDIF;
Storage.Set(Name:@storageName, Value:@newEntries);

Storage.Get(Name:@storageName);


Code Block
titleVersion (b) using Append, from v5.3 onwards
@loggedOnUsers = Users.GetLoggedOnUsers();
@newEntries = SELECT *, datetime("now") AS Timestamp FROM @loggedOnUsers;
@storageName = SELECT "LoggedInAudit" AS Name;
Storage.Set(Name:@storageName, Value:@newEntries, Append:true);

Storage.Get(Name:@storageName);


Platforms
  • Windows
  • Linux
  • MacOS
  • Solaris Intel
  • Solaris Sparc
  • Android
Notes

This method can be used with the agent language's SCALE evaluate statement to abandon processing if the persistent storage table is not present.

See User Defined Persistent Storage page for guidance using persistent storage tables.

The following methods existing in the Agent Storage module:

Content by Label
showLabelsfalse
max200
showSpacefalse
sorttitle
excerptTyperich content
cqllabel = "storagemodule"

...