I’m trying to find the best way to retrieve fields from a table, depending on the value of another field, all of it administered from a webapp.
For example, let a table person contain 4 fields: name,surname,email,mobile.
And let have to an admin of the web app the possibility to specify if one of such fields is visible or not, for each entry, for example by setting a checkbox..
How can I address such problem?
Should i use the trivial solution of adding 4 more boolean fields to the table (or making another table for that purpouse) to control the visibility? eg.: b_name,b_surname,b_email,b_mobile
-or-
should I use a mask approach (eg.: storing somewhere 1101, basically meaning ‘do not show email for that entry’)?
Any other alternatives?
I’d suggest the boolean fields, yeah. Masks are cumbersome and run counter to the database paradigm (and what’s more, they’ll make adding or changing fields an issue later on.)