Arenas, Endpoints and Protocols

We have seen how to save and load data and how to find previously saved data using the Persistence Viewer. Arenas were mentioned as a place to store data. However, the Local Arena is only accessible to the logged-on User and so that does not allow data to be shared easily.

To share data we need to create an Arena that is accessible to our colleagues. This is done using the PersisTables Management->Arena Manager accessed by right clicking on an empty cell.

Arena Manager accessed from PersisTables Management context menu
Arena Manager with pre-defined Local Arena settings

With a new installation a User will have one Arena defined – ‘Local’. This ‘Local’ Arena is a Windows file-based persistence store, located within the User’s \PersisTables\AppData area and uses a Text based encoding protocol. It is selected as the default Arena. (If a moniker does not mention an Arena name then TKTable_Save() automatically saves data in the default Arena).

To share data we need to create a new (shared) Arena. This is achieved using the Add Arena button.

Defining a new shared Arena

Here we have defined the ‘Shared’ Arena which saves data to the Windows file system located on a Dropbox shared account. In this case the ‘End Point’ is the Windows file system and the file Protocol is CSV (Comma Separated Values) format. We have ‘Selected’ the Arena so it will be the default Arena used if no Arena is specified in the moniker. In addition we have defined the original Local Arena as a fallback Arena; this allows us to see any data saved in Local as if it was part of Shared.

Once Created, the Arena is immediately available for use. Note that the location specified for the Arena must already exist, otherwise an error will be reported and the Arena will not be created.

Opening the Persistence Viewer shows the new Arena (and because it is the Selected Arena it is displayed automatically).

Viewing Shared Arena

Even though nothing has been saved into the ‘Shared’ Arena, the Persistence Viewer shows the data we saved in the Local Arena. This is because the ‘Include Fallback Arenas’ option has been ticked. PersisTables can be viewed and loaded from a Fallback Arena but not written back to that Arena unless the Arena is directly referenced in the Moniker. A typical use would be to have a ‘Test’ Arena with a fallback to ‘Production’. The user can read the Production data but only write to the Test Arena. This allows localised testing to be carried out without altering the production data.

So far we have used the CSV Protocol to save data. This protocol creates a file where the contents of each row is output in a single line of a text file with commas separating the cell values. This is a common format used with Excel based applications although it does have shortcomings. For instance, the protocol cannot handle a cell that contains a string with a comma embedded in it.

Just as there can be different protocols, so there can be different EndPoints. For instance, PersisTables includes an SQL Server EndPoint that allows all data to be held in an SQL Server database. This option provides a clearly improved level of security.

There are alternative protocols available which format the data as XML, JSON or text. These allow for auto-recognition of the Protocol when a file is loaded so it is not necessary to specify this information in the Moniker. Perhaps more importantly it is possible to create more complex data representations with multiple element of data being packaged into a single PersisTable by embedding Tables within other Tables.

Back

Copyright © 2020 Persis Solutions Limited