views:

403

answers:

3

Hi,

I often run into a situation where I need to come up with a GUI to edit data that has a n:m relationship. I'm looking for user friendly GUI ideas.

[table1]
   |
  /|\
[table2]
  \|/
   |
[table3]

Usually the GUI resembles something like this:


Grid that shows all items from table1

Add table3 item... (shows modal window with table3 items)


Grid that shows all items from table3


After the user picked a table3 item, I add a new row to table2 and refresh the grids.

Disadvantages:

  • You can only add table3 items to table1, and not the other way around;
  • You can only browse table1 items and see related table3 items;
  • I need to have one filtered grid of table3 items, and a similar one to pick new items;

My question:

Does anyone know a better way to visually browse and edit data that has a n:m relationship? Or any nice patterns that I could "steal" from existing software packages?

+2  A: 

Solution 1

If the data sets are not too big, use a table and allow users to place checks in cells (table 1 is X axis and table3 is Y axis).

You can probably do this for larger table1/3 data sets as long as you allow users to filter or otherwise limit which values are displayed on x and y axis.

Solution 2

To quote from this page, "A many-to-many relationship is really two one-to-many relationships with a junction/link table".

As such, you can, as one solution, simply take your own solution and resolve your first 2 dis-advantages by having screens/dialogs to go table 1=>3 as well as 3=>1.

Not a perfect solution but at least provides all the needed functionality

Solution 3

Somewhat similar to your own solution:

  1. Show a table based on table1, with:

    B. col1 containing table1 elements

    C. col2 containing a list of all elements from table3 already associated with this element from table1.

    The list can be either horizontal if there are usually few elements associated, or vertical (scrollable) if horizontal to too wide.

    The important part is that every displayed element from table3 has a "delete" icon (x) next to it to allow removal quickly.

  2. Allow choosing which element from table1 you want to add mappings to.

    There are 2 ways of doing this - either add a checkbox to every row in your table, and have one button labeled "add relationships to selected rows" (wording needs improvement), or simply have a 3-rd column in the table, containing button/link for adding relationships to that individual row.

    The former is a good idea if the user is likely to often add exactly the same set of element from table3 to several rows from table1.

  3. When "Add" button/link is clicked, you display a filterable multi-select list of elements from table3, with "add selected" button.

  4. As in your solution (see my #2), this is a-symmetrical so you should implement a mirror UI for mapping from table3 to table1 if needed.

DVK
+1  A: 

Here's a possible solution, given in the form of an employees-to-projects m:m relationship. Each employee can work on many projects, each project can involve many employees.

From left to right, you show the following:

A panel showing the details of the currently selected employee.

A list of all employees, where each item in the list shows the employee's name as a clickable link or button (to display details in the detail panel). At the head of the list is a toggle button which filters the projects list to only those associated with the currently selected employee. At the foot of the list is a button to add a new employee, which display an empty details panel ready to accept input.

A vertical space in the middle with a single "Link" button allowing the user to link the currently selected employee with the currently selected project. Clicking this button would open a dialog allowing the user to enter details of the link (i.e. how long the employee is assigned, what role the eployee will play, etc).

A list of all projects, where each item in the list shows the project's name as a clickable link or button (to display details in the detail panel). At the head of the list is a toggle button which filters the employees list to only those associated with the currently selected projet. At the foot of the list is a button to add a new project, which display an empty details panel ready to accept input.

A panel showing the details of the currently selected project.

Obviously, you'd have to limit the size of the details panels, maybe by only showing the details relevant to the m:m relationship. You might even add a button on the details panel to open a more detailed pop-up window, or you might do away with the details panel altogether, if you're mainly interested in managing the links. This UI would work really well on wide-aspect screens.

HTH! Klay

Klay
Klay - OK, i think I'm being dense, how is this different from original poster's own solution?
DVK
I'm honestly not sure what to make of the OP's solution. It may be that the "Add table3 item" box was supposed to be an "Add table2 item" box, which would make it more understandable.
Klay
Since I don't understand how the OP' solution was supposed to work, I don't understand exactly how the difficulties arise. What does it means to "add" table3 items to table1 items (or vice versa)? You're simply making associations between the two. Since associations (as opposed to parent-child relationships) are symmetrical, Disadvantage 1 is moot.
Klay
Disadvantage 2 may be an artifact of the OP's solution, but it's no problem to browse either list in my solution and see the related members in the other table. I also don't really get Disadvantage 3: what does it mean to "pick new items"? I assumed the OP meant "create new items", which is also allowed for in my solution.
Klay
A: 

Let me use the One Customer Has 0 or many Orders relationship example. If user wants to see the Orders of particular form I would suggest the following Use Case: 1. The User clicks the Search Customer link: 2. The System presents the Search Customer Form having the search criteria to filter on
3. The User fills the Search Critera and hits the Search button 4. The System presents a list of the Customer ... by the matched criteria 5. The User hits the Open button in front of A Customer 6. The System presents the Customer ( in totally new page with "Back to Search Button ") The new Page has 3 panels - 1 panel for Customer Details , second ichPanel for the list of Orders and 3 panel which gets populated hen a Order is clicked. If the number of Orders is greater than 20 I would but a Search Orders link which guides to entiryly new SEarch formr for Orders with a predifined CustomerId fixed with the current CustomerId selected.

YordanGeorgiev