R
ricm
The requirement is for a database that holds boolean data for a large 2-d
matrix. It seems to me there are two approaches:
First: create a table with enough fields for all the columns, add rows
corresponding to each row in the matrix. This is easy but wasteful because
the "true" data entries will be relatively sparse.
Second: Create two tables, one for all the colum names [Table_columns], the
other for all the rows [Table_rows]. Store the data in a third table
[Table_data] in the form [Data_Id,Row_Index,Column_Index] where the index
values point to the row and colum tables respectively. This has the advantage
of being able to store only the 'true' elements.
A further requirement is that the number of rows and columns, together with
their names is not fixed. This requirement alone seems to push the design in
favour of option 2, above.
The problem (for me) is the form design which allows both reads/writes: how
to display such a matrix without having pre-defined fields hidden/unhidden on
the form (a somewhat inelegant if not impossible solution given the above
requirements). A datasheet would seem ideal.
Two questions: First: do you think (as I do) the 2nd option is the best way
forward for the table design? Second: Can anyone give me pointers as to how I
should start to think about ways of developing a suitable form? My thoughts
so far are to create a temp table from Table_rows, Table_columns and
Table_data and use this as the recordsource for the form when it opens, then
iterate the temp table, writing values back to Table_data when the form
closes (or some other user-driven event).
Hope this makes sense. Thanks, Ric
matrix. It seems to me there are two approaches:
First: create a table with enough fields for all the columns, add rows
corresponding to each row in the matrix. This is easy but wasteful because
the "true" data entries will be relatively sparse.
Second: Create two tables, one for all the colum names [Table_columns], the
other for all the rows [Table_rows]. Store the data in a third table
[Table_data] in the form [Data_Id,Row_Index,Column_Index] where the index
values point to the row and colum tables respectively. This has the advantage
of being able to store only the 'true' elements.
A further requirement is that the number of rows and columns, together with
their names is not fixed. This requirement alone seems to push the design in
favour of option 2, above.
The problem (for me) is the form design which allows both reads/writes: how
to display such a matrix without having pre-defined fields hidden/unhidden on
the form (a somewhat inelegant if not impossible solution given the above
requirements). A datasheet would seem ideal.
Two questions: First: do you think (as I do) the 2nd option is the best way
forward for the table design? Second: Can anyone give me pointers as to how I
should start to think about ways of developing a suitable form? My thoughts
so far are to create a temp table from Table_rows, Table_columns and
Table_data and use this as the recordsource for the form when it opens, then
iterate the temp table, writing values back to Table_data when the form
closes (or some other user-driven event).
Hope this makes sense. Thanks, Ric