Skip to main content

1E 8.1 (on-premises)

Storage.Set

Method

Set

Module

Storage

Library

Core

Action

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 (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).

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.

The range is 1 to the SelectRowsLimit configuration value (100000 by default). This can be specified only if Append is true. There is no limit when overwriting (i.e. when Append is explicitly or implicitly false).

Note

Regarding truncation behaviour, the new (appended) data is considered more important than the old (original) data, so rows are deleted from the front of the table. Also, after the append there will be no more than MaxRowCount rows left in the table. For example, if the table originally contained rows 1 to 10 then we append rows 11 to 15 with MaxRowCount set to 6 then we end up with a table containing rows 10 to 15.

Return values

Name (string): The name of the new or updated persistent storage table.

Examples

A simple example.

@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, these show examples of a task that would be run periodically to record who is logged on at that time. They also return the accumulated data.

Using Append

@loggedOnUsers = Users.GetLoggedOnUsers();
@newEntries = SELECT *, datetime("now") AS Timestamp FROM @loggedOnUsers;
@storageName = SELECT "LoggedInAudit" AS Name;

// Store data
Storage.Set(Name:@storageName, Value:@newEntries, Append:true);
Storage.Get(Name:@storageName);

Platforms

  • Windows

  • Linux

  • MacOS

Notes