Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Multiple parent/child relations between 2 tables
Multiple parent/child relations between 2 tables [message #1346] Fri, 23 May 2008 16:45 Go to previous message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
I am working on a project tracking application, which keeps track of both the hierarchy of tasks (tree) and dependencies between tasks (graph).


mysql> desc task;               mysql> desc task_order;
+----------------+- ...         +-----------------+- ...      
| Field          |              | Field           |
+----------------+- ...         +-----------------+- ...
| task_id        |              | blocked_task_id |
| project_id     |              | waiting_task_id |
| parent_task_id |              +-----------------+- ...
| name           |
| estimate_days  |
| description    |
| start_date     |
| end_date       |
+----------------+- ...


The task hierarchy is taken care of through the task.parent_task_id field, and is working fine. Relating the task table to itself using an alias was no problem.

The dependencies are represented using task_order, where task_order.waiting_task_id represents the item that task_order.blocked_task_id is waiting on. These fields together are the primary key and they both refer to task_id. I feel like this is a reasonable way to represent the graph edges.

I added 2 relations on task in the dictionary:
task (aliased as task_blocked) --> task_order (aliased as task_order_blocked)
task (aliased as task_waiting) --> task_order (aliased as task_order_waiting)
I am not confident that I did this correctly, so please set me straight here if need be.

The problems emerged when I tried to set up a list2 transaction using task as the outer table and task_order as the inner table. When I tried to add a new record (add2), it complained that I had not selected a parent. I then tried using task_order_waiting and task_order_blocked for the inner table, which didn't help.

So, I tried instead to set up a list1 transaction for task_order. This time I was able to get to the add1 screen, which displayed a textbox for both blocked_task_id and waiting_task_id. I modified the task_order.dict.inc file to use task(popup1) for both fields, but this didn't work the way I had hoped. Both popups return a value to the blocked_task_id field, so I am unable to complete the add operation.

I suspect that I am making some combination of simple mistakes, but I didn't find a good example of this type of design pattern in the documentation -- specifically, what the dict file should look like. If you have a page (or previous forum post) on this, please point me to it. Otherwise, do you see where I am going wrong here? My goal is to set up task_order as a list2 transaction that I can get to from a list1 or list2 of task records.

[Updated on: Fri, 23 May 2008 16:47]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How do you deploy your app?
Next Topic: Use update2 pattern when I have two tables parent->child
Goto Forum:
  


Current Time: Fri Nov 22 10:30:25 EST 2024

Total time taken to generate the page: 0.01030 seconds