4GL Patterns #1 – Select or Add

A common pattern found in database applications is the “Select or Add” pattern.

The pattern allows a user to either

  • select an existing item (usually a foreign key), or
  • to add a new item to the foreign key table, then refresh the combo box, and setting the item to the newly added one

Example
The following is a screenshot from Django’s auto-generated administration screens.
The user is presented with a drop-down box, or a plus icon to add new items to the drop-down list.

Select or Add

Select or Add

The following shows an alternate approach, where an “Add” keyword is added to the bottom of a pick list. This approach can be harder to internationalize.

Other notes

When a new Create Data form is shown to the user, while it may be convenient to make this form modal, so that the parent form can refresh it’s pick list. It may be better to present a non-modal interface so that the user is not blocked from performing other work. This can be done by providing a callback whenever an item is created.

Related Ideas

  • Stable foreign keys
  • Caching

3 Comments

  1. [...] 4GL Patterns #1 – Select or Add [...]

  2. Chui, have you seen Sculptor, at http://fornax-platform.org/cp/display/fornax/Sculptor+%28CSC%29 ? Its the best example I’ve seen of a business CRUD DSL, which should in theory express most or all of the 4GL patterns you have identified (i.e. if it doesn’t, then it probably should).

  3. Thanks for the heads up. I had a quick look.
    Pros: build on top of well-known technologies, high level of testability
    Cons: I couldn’t find a spec for the DSL, so it’s hard to evaluate how complete it is.

Comments are closed.