Using a 3D HTML Table as a Recordset
(Page 1 of 4 )
The HTML specification does not give an HTML element for a 3D table. There are, however, several ways of designing a 3D table. Last week's article showed you my own way of doing so. I strongly advise you to read that one first, before you read this one, which will go into greater detail and show you how to manipulate a 3D HTML table.
My design for a 3D table is as follows: you have the normal 2D table. Each cell in the table has only one element, which is a one-row table (a table with only one row). It is the cells of the one-row tables that can take arbitrary content. Each one-row table must have an ID. The following diagram illustrates how I give the IDs.
T00, T01, T02, T03, T04
T10, T11, T12, T13, T14
T20, T21, T22, T23, T24
T30, T31, T32, T33, T34
T40, T41, T42, T43, T44
T50, T51, T52, T53, T54
Each ID begins with a T, followed by the number of the 2D row to which the one-row table belongs, and then the number of the 2D column to which the one-row table also belongs. You should imagine each of the one-row tables to be going into the page, giving you the third dimension.
If the number of cells of the one-row tables are the same, then you have a cuboid, which is a regular 3D table. If they are not the same, then you have an irregular 3D table. In this article I only consider cases of regular 3D tables.
Planes
You can consider the cells to be in a 3D grid with horizontal and vertical planes. The vertical planes should be imagined as 2D tables, one behind the other, into the page.
Indices
Counting of all indices begins from zero. I use the variable i to denote the index for a row in the normal 2D table; the variable j to denote the index for a column in the normal 2D table; and the variable k to denote the index for a vertical plane in the 3D table. This gives an index order of (i, j, k).
Reasons for 3D Recordsets
I will use a hypothetical example. Imagine that you own a bookshop with three branches in three different states in the U.S.A. For simplicity just assume that you sell only books, pens and pencils. Each of the bookshops has a database. Each database has a table of products ordered. The following are three simplified forms of these tables:
No. Cost($)
Books 100 1500
Pens 50 150
Pencils 15 200
No. Cost($)
Books 125 1900
Pens 70 210
Pencils 20 240
No. Cost($)
Books 135 2100
Pens 75 220
Pencils 25 255
You may want to compare the cost of books in the three different branches. You may want to compare the number of pens ordered in the three different branches. You may want to know the overall costs of pencils ordered in the three different branches. Would it not be nice if you have the above tables in a 3D recordset, the first one in the first vertical plane, the next one in the next vertical plane and the third one in the third vertical plane? Then you can make the comparison by looking at a line of cells through the vertical planes.
This should be one of the purposes for a 3D recordset. I plan to write a full article on this. In this article, the aim is to show you the qualities of a 3D HTML table as a recordset.
You can also use it to calculate the averages of marks per student per subject in a sequence of tests for all subjects in a class. This is the subject of another article I will write after this.
Comment: Concerning personal computers, it is said that when IBM came up with the 1MB memory for the first time, they did not know what to do with all the space. I have come up with a 3D recordset; it looks good but I do not know the many things you can do with it.
Three-dimensional works are a logical next step from two-dimensional works. I do not know if I am the first person to come up with a 3D recordset. I may not be the first, but I have to emphasize its use or advantages and feasibility with today's technology. That is why I have written at least two more articles on it. Note that even though we talk about working with two-dimensional or three-dimensional arrays (tables), analysis (or coding) is fundamentally done in one dimension. Fundamentally the array (table) is addressed cell by cell.
At this moment you may be wondering whether having a 3D recordset at the client will not slow down transmission time from the server. Do not worry, that problem can be solved today. I plan to write an article on that, hopefully within the next two months.
Next: The CSS Display Property >>
More HTML Articles
More By Chrysanthus Forcha