Skip to Content

How to a create session table

All interactions with Vinyl occur within the context of a web "session". A session is created when a User first visits Vinyl, and subsequent requests from the same User are associated with the same session. This guide will step you through how to create a Session table in Vinyl, and then associate it with a Rule and an Event.

Business use cases for sessions

  • Track and distinguish between authenticated Users under the same account. For example, if two people are both signed in as an Admin User, Sessions allows you to track them individually.
  • Track multiple anonymous Users
  • Filter report criteria based on session

To create a session table

The first step is to create the Session table in the Data Storage Layer.

  1. Navigate to the App Workbench
  2. Click + Table
  3. Assign the Name as Session, and click Save
  4. Confirm a UUID Primary Key Column has been created for SessionID
  5. Add any remaining Columns you need that are relative to your session. This is specific to application needs.
  6. Click the Enhance Table button and Proceed

The second step is to create a Default Rule against the Session table.


You do not need to insert a Table in this Rule definition. This can work using a Parameter table, as there is only every one record. If you use a multi-record table, it will likely break the Default Rule.

  1. Navigate to the App Workbench > Rules
  2. Select By Table, then select the Session table from the Tables panel
  3. Click the + Rule button from the Rules panel
  4. Set the Purpose to Default
  5. Assign the Name as Session (New Session Default)
  6. Click Save
  7. Vinyl will automatically add the Session table to your Business Object, which should be deleted
  8. Click the Columns tab
  9. Click the + Column button add the expression session(), targeting SessionID, and assign an Alias as SessionID
  10. Click Save

The third step is to register the Default Rule so that when a new record is inserted, it defaults to the SessionID.

  1. Navigate to the App Workbench > Rules
  2. Select By Table, locate the Session table and click Open Record
  3. Click on More > Edge Case
  4. Click the Defaults button
  5. Click the Register Existing button
  6. Set the Rule to Session (New Session Default)
  7. Set the Binding Type to Explicit
  8. Click the Save button

The fourth step is to create a custom Event referencing an Intrinsic Vinyl Event that runs when querying the table via the application User Interface.

  1. Navigate to the App Workbench > Rules
  2. Select By Table, locate the Session table
  3. Click the Events icon for the Session Table
  4. Click + Table Event on the Data Storage Events panel
  5. Assign the Name as Filter
  6. Click Save and exit the window
  7. Click Register Existing under Actions
  8. Change the Type value to Plugin
  9. Select the Plugin named "Create row on empty table". This plugin will create a new row if the Filter Event returns no rows.
  10. Enter Technical Help description
  11. Click the Save button