Table Recognition Algorithm
Table Recognition Algorithm
This section describes an algorithm of how the OpenL Tablets engine looks for supported tables in Excel files. It is important to build tables according to the requirements of this algorithm; otherwise, the tables are not recognized correctly.
OpenL Tablets utilizes Excel concepts of workbooks and worksheets, which can be represented and maintained in multiple Excel files. OpenL Tablets does not use any of Excel’s formula capabilities though. Any calculations performed in OpenL Tablets are done using OpenL syntax, which is completely distinct from any formula syntax used by Excel. Excel worksheets can be named and arranged within one workbook in the order convenient to a user. Each worksheet, in its turn, is comprised of one or more tables. Workbooks can include tables of different types, each one supporting different underlying logic.
The general table recognition algorithm is as follows:
-
The engine looks into each spreadsheet and tries to identify logical tables.
Logical tables must be separated by at least one empty row or column or start at the very first row or column. Table parsing is performed from left to right and from top to bottom. The first populated cell that does not belong to a previously parsed table becomes the top-left corner of a new logical table.
-
The engine reads text in the top left cell of a recognized logical table to determine its type.
If the top left cell of a table starts with a predefined keyword, such table is recognized as an OpenL Tablets table.
The following are the supported keywords:
Keyword Table type Constants Constants Table ColumnMatch Column Match Table Data Data Table Datatype Datatype Table Environment Configuration Table Method Method Table Properties Properties Table Rules Decision Table Run Run Table SimpleLookup Simple Lookup Table SimpleRules Simple Rules Table SmartLookup Smart Lookup Table SmartRules Smart Rules Table Spreadsheet Spreadsheet Table TablePart Table Part TBasic or Algorithm TBasic Table Test Test Table All tables that do not have any of the preceding keywords in the top left cell are ignored. They can be used as comments in Excel files.
-
The engine determines the width and height of the table using populated cells as clues.
It is a good practice to merge all cells in the first table row, so the first row explicitly specifies the table width. The first row is called the table header.
Note: To put a table title before the header row, an empty row must be used between the title and the first row of the actual table.