Thinking About Value Lists, part 2
Posted on November 7, 2012 by Kevin Frank
In part 1 we explored a particular type of value list: the field-based two-column variety, based on all values, and set to show values from the second column only…
…and today’s article assumes familiarity with that material. This time around we’re going to look at some challenges and issues that can arise when using filtered (a.k.a. “conditional”) field-based value lists, and propose some solutions to those challenges.
I don’t claim that any of the following is particularly original or brilliant, but I do a fair amount of team programming, and these issues come up over and over again.
The value list (a.k.a. VL) issues we’re going to examine are:
Active vs. AllPortabilityFind mode vs. Browse mode vs. “Edit mode”
…and it seems to me that these issues overlap in messy ways, as opposed to being clear cut and discrete, but sometimes life is like that. At any rate, in all of today’s imaginatively titled demo files…
Thinking About Value Lists, part 2 demo 1
Thinking About Value Lists, part 2 demo 2
Thinking About Value Lists, part 2 demo 3
…we have a table of employees, some of whom are active, and some of whom are not:
Here’s how the above layout looks under the hood:
During data entry, we need to access a popup menu of currently active employees from three table contexts: purchase orders, invoices and employee evaluations, like so:
A minute ago I mentioned the concept of “portability”. Within a given file, a VL may be considered “portable” if it works everywhere, i.e., from any layout/table context. It almost goes without saying that VLs based on “all values” are by their very nature accessible everywhere.
So if we want a 2-column VL of all employees, the most natural thing in the world would be to define it like so.
And along the same lines, there’s nothing to stop us from defining two new fields in the employees table…
…which gives us this…
…and then creating a value list for active employees based on those two fields:
And you can see that approach in demo #1. I don’t find the idea of defining two new fields every time I need a conditional value list to be particularly appealing, but a) that’s how we used to have to do it circa 1995, and b) sometimes quick and dirty gets the job done.
Another reason I don’t like this method is that it may not scale well if your conditional filtering requirements are more complex. At any rate, I include this method for the sake of completeness and as a nostalgic reminder of simpler times.
One final point perhaps worth making: there are no relationships in demo #1. Each table occurrence on the graph is an island unto itself. The 2-column VL takes care of “the magic” of showing the correct employee name on the P.O., Invoice and Evaluation layouts, although we’re only storing the foreign key (id_employee).
Your new post is loading...