We add almost all of our applications / products with additional support for attributes / fields for this flexibility for the user.
As we have a product category, in the category a customer can define an additional attribute of any product
what we do at the database level:
The category table has an additional column, for example: Text1Att, Text2Att ... for supporting text values, Num1Att, Num2Att ... for supporting number values, Date1Att, Date2Att ... for supporting date and time values, ID1Att, ID2Att ... support identifier from another table, as you can add a drop-down list, list, ...
here the entire column is of the String data type.
what we store here
we will store meta-information here, for example, for Text1Att meta
PLA; text field; fifty; true False; NULL
Field heading; Type of management; Maximum length; Obligatory field; Spot check required; Custom verification message;
place of birth, text box; one hundred; true true Invalid value
Same thing for a number field ...
for date metadata, the date will look like this:
date of birth, calendar control, true, true, invalid date;
Field signature; Calendar control or may be different; required, is a user check; Custom verification message;
What it does in the product table, adds the same number of columns and has the data type text1Att, .. is varchar, num1Att has a numerical value, date1Att has a date and time, ID1Att has int
What we do with the GUI: on the category definition page, add these attributes and create meta-information at run time and save it in the category table
On the other hand, when we define a product in a category, meta-information will be read and moved from the category table and filled in on the product definition page, as in other fields.
If you need more help, I can provide you with images so that you better understand how to do this.
we are experience and analysis, this is a very flexible approach
Muhammad Akhtar Jun 07 '09 at 6:15 2009-06-07 06:15
source share