LegalSuite Database Structure
Understanding the LegalSuite Database Tables
Introduction
LegalSuite is a Windows-based program designed to assist attorneys in managing their legal practices. It is written in Clarion and .Net and uses the MS SQL database to store the program’s data. It also exposes an API to allow 3rd party programs to access the data. This document serves to provide a brief overview of the database structure to assist those wanting to access the data from the API.
The Matter Table
An attorney typically has numerous Clients (stored in the Party table) and each Client may have one or more Matters. Most of the information regarding a Matter is stored in the Matter table, but additional Matter information may also be found in ColData, ConveyData and BondData depending on the type of Matter.
Every table in LegalSuite has a Primary Key based on an auto-incrementing integer called RecordID.
The Matter table also has a unique key on the FileRef column (which is the how the user typically identifies a Matter from the front end).
SQL: SELECT RecordID, FileRef, Description, ClaimAmount, MatterTypeID FROM Matter
Internally, the Clarion language identifies a table column by a table prefix and the column name. In the above example, the five columns are referenced as MAT:RecordID, MAT:FileRef, MAT:Description, MAT:ClaimAmount, MAT:MatterTypeID in the actual programming code. You can use this internal syntax to identify the table and the column name.
To find out the table and name of a particular database column, load the LegalSuite program and go to the relevant form and hover your cursor over an field until the tooltip appears. The table prefix and column name is displayed in the last line of the tooltip.
Tooltips contain the Table Prefix Column name of each field
In the above example, MAT:FileRef indicates that this data is stored in the Matter (MAT:) table and its column name is FileRef.
Tip
To view a complete listing of all the columns in the Matter table, you
can use this SQL script
SELECT Column_Name, Data_Type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Matter' ORDER BY Column_Name
Note: To view other tables, simply replace the word ‘Matter’ with the table name in the above script.
The Party and MatParty Tables
All Parties are stored in the Party table.
A Client is a Party who plays the role of Client on a particular Matter.
The Party table also has a unique key on the Codecolumn (which is the how the user typically identifies a Party from the front end).
SQL: SELECT RecordID, Code, Name, VatNumber, PartyTypeID FROM Party
Matters typically have a number of Parties (Matter Parties) associated with it which represent the Parties involved in the Matter.
For example, John Smith may be the Client, Absa Bank may be the Defendant
and John Smith may also be the Plaintiff. In other words, a Party
can play more than one role on a Matter.
The Matter’s Parties are stored in the MatParty table which is a joining table between the Matter and Party tables.
SQL: SELECT RecordID, MatterID, PartyID, RoleID FROM MatParty WHERE MatterID = 1
The RoleId column identifies the role the Party plays on the
Matter. In the above example, RoleID = 1 is the Client role, RoleID = 2 is
the Plaintiff role and RoleID = 3 is the Defendant role. Roles are stored
in the Role table.
SQL: SELECT RecordID, Description FROM Role
Parent and Child Tables
Parent tables are those which have tables linked to them in a one-to many relationship. The Matter table is often the Parent to numerous child tables. For example, the File Notes, Fee Notes and Reminders are all children of the Matter table.
The FeeNote table is linked to the Matter table by FN:MatterID = MAT:RecordID
Notice that the link is based on the MatterID of the FeeNote (FN:MatterID) and the RecordID of the Matter (MAT:RecordID). This is a common pattern used in LegalSuite.
Here is a list of the main tables and their prefixes:
Party Relationships
Party Relationships
Matter Relationships
Child tables linked to a Matter
Conclusion
The LegalSuite database comprises of over 200 tables, but the core of the program centres around the Matter and Party tables (and their parent tables and child tables).
With an understanding of how these relate to each other, a 3rd party developer can access most of the most critical data required by a client.